mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-20 06:13:47 +08:00
Clean up print_help
`print_help` is a hacky-wacky function used to support the `--help` command of `fish_key_reader` and others. The Rust version panics on an error; fix that and make it print more useful help messages.
This commit is contained in:
parent
262e2d5fe6
commit
c4bc6b6f09
|
@ -11,8 +11,13 @@ pub fn print_help(command: &str) {
|
||||||
cmdline.push("__fish_print_help ");
|
cmdline.push("__fish_print_help ");
|
||||||
cmdline.push(command);
|
cmdline.push(command);
|
||||||
|
|
||||||
Command::new("fish")
|
match Command::new("fish")
|
||||||
.args([OsStr::new("-c"), &cmdline])
|
.args([OsStr::new("-c"), &cmdline])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect(HELP_ERR);
|
.and_then(|mut c| c.wait())
|
||||||
|
{
|
||||||
|
Ok(status) if !status.success() => eprintln!("{}", HELP_ERR),
|
||||||
|
Err(e) => eprintln!("{}: {}", HELP_ERR, e),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user