Skip to content

shell competion for sub-commands using derive OM #3657

Answered by epage
ProphetLamb asked this question in Q&A
Discussion options

You must be logged in to vote

The docs explain how I may enable shell completion given a Command struct, but such a struct only exists when using the builder syntax.

Derive Reference's tips calls attention to how to access a Command:

To get access to a Command call CommandFactory::command (implemented when deriving Parser)

This is important for other reasons, like

Proactively check for bad Command configurations by calling Command::debug_assert in a test (example)

clap_complete also comes with a derive example, https://github.com/clap-rs/clap/blob/master/clap_complete/examples/value_hints_derive.rs.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ProphetLamb
Comment options

@andreasnuesslein
Comment options

Answer selected by ProphetLamb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants