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:
Lzu Tao 2024-07-06 07:58:43 +07:00
parent a6ac45f566
commit 2167fee212

View file

@ -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());
}