You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the command chaining example from the docs:
use bpaf::{construct, long, positional, short,OptionParser,Parser};#[derive(Debug,Clone)]pubstructOptions{premium:bool,commands:Vec<Cmd>,}#[derive(Debug,Clone)]// shape of the variants doesn't really matter, let's use all of them :)enumCmd{Eat(String),Drink{coffee:bool},Sleep{time:usize},}fncmd() -> implParser<Cmd>{let eat = positional::<String>("FOOD").to_options().descr("Performs eating action").command("eat").adjacent().map(Cmd::Eat);let coffee = long("coffee").help("Are you going to drink coffee?").switch();let drink = construct!(Cmd::Drink{ coffee }).to_options().descr("Performs drinking action").command("drink").adjacent();let time = long("time").argument::<usize>("HOURS");let sleep = construct!(Cmd::Sleep{ time }).to_options().descr("Performs taking a nap action").command("sleep").adjacent();construct!([eat, drink, sleep])}pubfnoptions() -> OptionParser<Options>{let premium = short('p').long("premium").help("Opt in for premium serivces").switch();let commands = cmd().many();construct!(Options{ premium, commands }).to_options()}fnmain(){println!("{:?}", options().run())}
It yields the following help string:
Usage: bug [-p] [COMMAND ...]...
Available options:
-p, --premium Opt in for premium serivces
-h, --help Prints help information
Available commands:
eat Performs eating action
drink Performs drinking action
sleep Performs taking a nap action
Usage: bug [-p] [COMMAND ...]...
My Commands
eat Performs eating action
drink Performs drinking action
sleep Performs taking a nap action
Available options:
-p, --premium Opt in for premium serivces
-h, --help Prints help information
In particular, notice how the "Available options" section is now at the bottom. This could be annoying if the total number of commands is large.
Reproduced with bpaf 0.9.11
The text was updated successfully, but these errors were encountered:
Consider the command chaining example from the docs:
It yields the following help string:
Now, add a group help to the command parser:
The help string is now changed to the following:
In particular, notice how the "Available options" section is now at the bottom. This could be annoying if the total number of commands is large.
Reproduced with bpaf 0.9.11
The text was updated successfully, but these errors were encountered: