Fix stdin end of input
This commit is contained in:
parent
5b2eca1cf8
commit
e79df688ee
|
|
@ -8,7 +8,7 @@ indent_style = space
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.(md,rst,txt}]
|
||||
[*.{md,rst,txt}]
|
||||
indent_size = unset
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ zoxide can be installed in 4 easy steps:
|
|||
> Add this to the **end** of your config file or AutoRun command:
|
||||
>
|
||||
> ```batchfile
|
||||
> zoxide init cmd --hook none | cmd /d/q/k >nul
|
||||
> zoxide init cmd | cmd /d/q/k echo off
|
||||
> ```
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Add this to the \fBend\fR of your config file (usually \fB~/.bashrc\fR):
|
|||
Add this to the \fBend\fR of your config file or AutoRun command:
|
||||
.sp
|
||||
.nf
|
||||
\fBzoxide init cmd --hook none | cmd /d/q/k >nul\fR
|
||||
\fBzoxide init cmd | cmd /d/q/k echo off\fR
|
||||
.fi
|
||||
.TP
|
||||
.B elvish
|
||||
|
|
|
|||
24
src/shell.rs
24
src/shell.rs
|
|
@ -105,15 +105,15 @@ mod tests {
|
|||
let source = Cmd(&opts).render().unwrap();
|
||||
|
||||
let assert = Command::new(which::which("cmd.exe").unwrap())
|
||||
.args(["/d", "/x", "/k"])
|
||||
.args(["/x", "/d", "/q", "/k", "echo off"])
|
||||
.env("PROMPT", "")
|
||||
.write_stdin(source)
|
||||
.assert()
|
||||
.success();
|
||||
.success()
|
||||
.stderr("");
|
||||
|
||||
if opts.hook != InitHook::None {
|
||||
assert.stderr("zoxide: hooks are not supported on cmd.exe shell.\r\n");
|
||||
} else {
|
||||
assert.stderr("");
|
||||
if opts.hook == InitHook::None {
|
||||
assert.stdout("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,15 +124,15 @@ mod tests {
|
|||
let source = Cmd(&opts).render().unwrap();
|
||||
|
||||
let assert = Command::new(which::which("cmd.exe").unwrap())
|
||||
.args(["/d", "/y", "/k"])
|
||||
.args(["/y", "/d", "/q", "/k", "echo off"])
|
||||
.env("PROMPT", "")
|
||||
.write_stdin(source)
|
||||
.assert()
|
||||
.success();
|
||||
.success()
|
||||
.stderr("");
|
||||
|
||||
if opts.hook != InitHook::None {
|
||||
assert.stderr("zoxide: hooks are not supported on cmd.exe shell.\r\n");
|
||||
} else {
|
||||
assert.stderr("");
|
||||
if opts.hook == InitHook::None {
|
||||
assert.stdout("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
|
||||
rem Code generated by zoxide. DO NOT EDIT.
|
||||
|
||||
@if "%=^%=" == "%=%=" (
|
||||
set \p=%%<nul
|
||||
) else (
|
||||
set \p=^%<nul
|
||||
)
|
||||
@if "%=^%=" == "%=%=" (set \p=%%<nul) else (set \p=^%<nul)
|
||||
|
||||
set __program=zoxide
|
||||
|
||||
|
|
@ -19,7 +15,8 @@ rem Hook configuration for zoxide.
|
|||
rem
|
||||
|
||||
{% if hook != InitHook::None -%}
|
||||
>&2 echo %__program%: hooks are not supported on cmd.exe shell.
|
||||
echo %__program%: hooks are not supported on cmd.exe shell.
|
||||
echo Use '%__program% init cmd --hook none' instead.
|
||||
|
||||
{%- else -%}
|
||||
{{ not_configured }}
|
||||
|
|
@ -60,4 +57,9 @@ rem Jump to a directory using interactive search.
|
|||
{{ section }}
|
||||
rem To initialize zoxide, add this to your configuration or AutoRun command:
|
||||
rem
|
||||
rem zoxide init cmd --hook none | cmd /d/q/k >nul
|
||||
rem zoxide init cmd | cmd /d/q/k echo off
|
||||
|
||||
{#~
|
||||
Content piped to `cmd.exe` needs to end with an empty line to indicate end of
|
||||
input. Removing this will cause extra "More? " to be written to stdout.
|
||||
#}
|
||||
|
|
|
|||
Loading…
Reference in New Issue