Skip to content

Support fallback_to_usage in derive macro#376

Merged
pacak merged 4 commits intomasterfrom
ftu
Jul 22, 2024
Merged

Support fallback_to_usage in derive macro#376
pacak merged 4 commits intomasterfrom
ftu

Conversation

@pacak
Copy link
Copy Markdown
Owner

@pacak pacak commented Jul 21, 2024

You can specify them next to command annotation or options annotation. In either way if parser requires some arguments and user passed none - instead of producing "required ... not found" type of error bpaf will print the usage page for this parser or subcommand

Usage for option parser

#[derive(Debug, Clone, Bpaf)]
enum Commands {
    #[bpaf(command, fallback_to_usage)]
    Action {
        ...
    }
}

usage for subcommand

#[derive(Debug, Clone, Bpaf)]
#[bpaf(options, fallback_to_usage)]
struct Options {
    ...
}

@pacak pacak merged commit 74ef468 into master Jul 22, 2024
@pacak pacak deleted the ftu branch July 22, 2024 11:44
@pacak pacak mentioned this pull request Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant