mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
fix(fish): Don't handle level 3 nested subcommand
Nested subcommand more than 3 levels is not practical in public. Take rustup for example, `rustup toolchain install <version>`, there is only 3 levels of nested subcommands. But there is also the case of `rustup help toolchain install`, or `rustup toolchain help install`.
This commit is contained in:
parent
a6ac45f566
commit
2167fee212
1 changed files with 3 additions and 9 deletions
|
@ -121,15 +121,9 @@ fn gen_fish_inner(
|
|||
[command, subcommand] => out.push_str(&format!(
|
||||
" {command}; and __fish_seen_subcommand_from {subcommand}"
|
||||
)),
|
||||
[command, "help", _subcommand] => {
|
||||
out.push_str(&format!(" {command}; and __fish_seen_subcommand_from help"));
|
||||
}
|
||||
["help", command, _subcommand] => {
|
||||
out.push_str(&format!(" help; and __fish_seen_subcommand_from {command}"));
|
||||
}
|
||||
_ => unimplemented!(
|
||||
"subcommand should be nested less than 3 levels: {parent_commands:?}"
|
||||
),
|
||||
// Subcommand should be nested less than 3 levels to be practical
|
||||
// `rustup toolchain help install` cannot receive any flags to it.
|
||||
_ => return,
|
||||
}
|
||||
basic_template.push_str(format!(" -n \"{out}\"").as_str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue