Skip to content

Programmatic access to bpaf's usage message? #186

Answered by pacak
crispinb asked this question in Q&A
Discussion options

You must be logged in to vote

In bpaf terms subcommand is something with a dedicated name and help so the only thing help subcommand can display is a help for itself which is not very useful, you can return a default enum variant like so.

Next, to display the help message in your own code you can either use get_usage or implement your own variant of it - batteries only use public API so you can do that too.

In general capturing all the arguments from OS, adding extra --help at the end and passing it to Args::run_inner will give you help message

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@crispinb
Comment options

Answer selected by crispinb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
next gen Might or might not happen messages Help and error messages
2 participants
Converted from issue

This discussion was converted from issue #185 on March 23, 2023 12:23.