Replies: 2 comments 2 replies
-
fn command() -> impl Parser<HciCommand> {
short('c')
.long("command")
.help("choose between hci_reset or hci_read_bd_addr")
.argument::<HciCommand>("CMD")
.to_options()
.run();
} Last two lines mean you want to try to execute your parser, fn command() -> impl Parser<HciCommand> {
short('c')
.long("command")
.help("choose between hci_reset or hci_read_bd_addr")
.argument::<HciCommand>("CMD")
}
#[allow(dead_code)]
#[derive(Debug, Clone, Bpaf)]
#[bpaf(options)]
/// Example for bluetooth low energy controller demo
struct Options {
#[bpaf(short, long, argument::<String>("DEVICE"), parse(parse_device))]
/// [vendor]:[product] Open a device with the specified vendor and product ID.
/// Both IDs are given in hexadecimal.
device: (u16, u16),
/// Increase verbosity
#[bpaf(external)]
verbose: usize,
#[bpaf(short, long)]
reset: bool,
#[bpaf(short, long)]
/// Choose between hci_reset or hci_read_bd_addr
command: HciCommand,
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
How do you get the derive macro to pick up a help string. From the docs it
looks like this should work:
#[bpaf(short, long)]
// Reset the USB device
reset: bool,
But I cannot get it to.
```rust
// comment
/// doc string
```
You need doc string.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
potto216
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to map a command line option to a HciCommand enum but I keep getting an error that
the trait bound (): Parser<HciCommand> is not satisfied
. What is the best solution?My code is:
And I get the following error
Beta Was this translation helpful? Give feedback.
All reactions