-
I want a CLI that has a shared verbose flag for all subcommands. How can I define that using the derive API? |
Beta Was this translation helpful? Give feedback.
Answered by
pacak
Oct 25, 2022
Replies: 1 comment 7 replies
-
I'd have a top level Options struct containing all the shared flags as well as enum with commands: #[derive(Debug, Clone, Bpaf)]
#[bpaf(options)]
struct Options {
verbose: bool,
#[bpaf(external)]
action: Action
}
#[derive(Debug, Clone, Bpaf)]
enum Action {
#[bpaf(command)]
Foo,
#[bpaf(command)]
Bar,
} |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
mainrs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd have a top level Options struct containing all the shared flags as well as enum with commands: