Skip to content

Adding a single subcommand makes it mandatory? #324

Answered by polarathene
polarathene asked this question in Q&A
Discussion options

You must be logged in to vote

Solved: The optional annotation docs don't touch on it, perhaps it's assumed you've already read the top of this docs page for derive-specific considerations?

That section does demonstrate optional as a valid annotation for derive API, and that it is necessary in some contexts:

// Option wrapping the type is not sufficient here
// you also need to add the `optional` annotation,
// probably because it's annotated with `external`?
#[bpaf(external, optional)]
inspect: Option<Inspect>,

Now it's optional 🥳

Usage: capability-aware [-p=PORT] [--aware] [COMMAND ...]

Replies: 1 comment 2 replies

Comment options

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

@polarathene
Comment options

Answer selected by polarathene
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Improvements or additions to documentation parsing Running the parser to get results
2 participants