Skip to content

Commit

Permalink
chore: Explain why -lt 3 levels of subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jul 8, 2024
1 parent 1dd1056 commit eba26a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clap_complete/src/shells/fish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ fn gen_fish_inner(
[command, subcommand] => out.push_str(&format!(
" {command}; and __fish_seen_subcommand_from {subcommand}"
)),
// Subcommand should be nested less than 3 levels to be practical
// `rustup toolchain help install` cannot receive any flags to it.
// HACK: Assuming subcommands are only nested less than 3 levels as more than that is
// unwieldy and takes more effort to support.
// For example, `rustup toolchain help install` is the longest valid command line of `rustup`
// that uses nested subcommands, and it cannot receive any flags to it.
_ => return,
}
basic_template.push_str(format!(" -n \"{out}\"").as_str());
Expand Down

0 comments on commit eba26a9

Please sign in to comment.