Skip to content

Commit

Permalink
Add a simple group example (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceadams authored and TeXitoi committed Jun 28, 2018
1 parent d983649 commit ea76fa1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/simple_group.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#[macro_use]
extern crate structopt;

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
struct Opt {
/// Set a custom HTTP verb
#[structopt(long = "method", group = "verb")]
method: Option<String>,
/// HTTP GET; default if no other HTTP verb is selected
#[structopt(long = "get", group = "verb")]
get: bool,
/// HTTP HEAD
#[structopt(long = "head", group = "verb")]
head: bool,
/// HTTP POST
#[structopt(long = "post", group = "verb")]
post: bool,
/// HTTP PUT
#[structopt(long = "put", group = "verb")]
put: bool,
/// HTTP DELETE
#[structopt(long = "delete", group = "verb")]
delete: bool,
}

fn main() {
let opt = Opt::from_args();
println!("{:?}", opt);
}

0 comments on commit ea76fa1

Please sign in to comment.