mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
note about optional subcommands
This commit is contained in:
parent
a8e466c7bb
commit
12e88e1ea8
1 changed files with 19 additions and 0 deletions
|
@ -181,6 +181,25 @@
|
|||
//! + `make-cookie pound 50`
|
||||
//! + `make-cookie sparkle -mmm --color "green"`
|
||||
//! + `make-cookie finish 130 glaze 3`
|
||||
//!
|
||||
//! ### Optional subcommands
|
||||
//!
|
||||
//! A nested subcommand can be marked optional:
|
||||
//!
|
||||
//! #[derive(StructOpt)]
|
||||
//! #[structopt(name = "foo")]
|
||||
//! struct Foo {
|
||||
//! file: String,
|
||||
//! #[structopt(subcommand)]
|
||||
//! cmd: Option<Command>
|
||||
//! }
|
||||
//!
|
||||
//! #[derive(StructOpt)]
|
||||
//! enum Command {
|
||||
//! Bar {},
|
||||
//! Baz {},
|
||||
//! Quux {}
|
||||
//! }
|
||||
|
||||
extern crate proc_macro;
|
||||
extern crate syn;
|
||||
|
|
Loading…
Reference in a new issue