blob: 30b8cc37ae4459895e415b9cc1408ec53411d771 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
//! How to assign some aliases to subcommands
use structopt::clap::AppSettings;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
// https://docs.rs/clap/2/clap/enum.AppSettings.html#variant.InferSubcommands
#[structopt(setting = AppSettings::InferSubcommands)]
enum Opt {
// https://docs.rs/clap/2/clap/struct.App.html#method.alias
#[structopt(alias = "foobar")]
Foo,
// https://docs.rs/clap/2/clap/struct.App.html#method.aliases
#[structopt(aliases = &["baz", "fizz"])]
Bar,
}
fn main() {
let opt = Opt::from_args();
println!("{:?}", opt);
}
|