Closed Swivelgames closed 3 months ago
Clap has this but its not expressed through groups. As someone who mostly did CLIs in Python before Rust, this surprised me about clap but it turned out to be so much better. Groups are a way of tagging arguments to define arbitrary relationships. These can't boil down to simple things like "organize help by group". Instead, clap has the concept of applying a help_heading
to an argument. See the find example for what this looks like in code (builder API but concept carries over) and in the help output.
@epage Oh, awesome! I totally overlooked that. :sweat_smile: Thanks! Apologies for the frivolous issue :upside_down_face:
Please complete the following tasks
Clap Version
4.4.7
Describe your use case
ArgGroups are very useful for developers, but they don't always show up sequentially in the help text, which can make it difficult to decipher between different options.
For instance, all
+
are part of the "Initializer"ArgGroup
, and the-
are this specific subcommand's options. The rest areglobal = true
options:Describe the solution you'd like
It would be great if we could visually separate options and arguments from the rest of the list if they're grouped, to make it easier to read for users:
Again, all
+
are part of the "Initializer"ArgGroup
, and the-
are this specific subcommand's options. The rest areglobal = true
options:I'm imagining this implemented with something like
#[group(distinguish = true)]
: