blob: 494e9d1f71c4ad830504e40757599e2bf31ed12c [file] [log] [blame]
Matthew Maurer32e76692020-06-02 11:15:15 -07001//! `git.rs` serves as a demonstration of how to use subcommands,
2//! as well as a demonstration of adding documentation to subcommands.
3//! Documentation can be added either through doc comments or
4//! `help`/`about` attributes.
5
6use structopt::StructOpt;
7
8#[derive(StructOpt, Debug)]
9#[structopt(name = "git")]
10/// the stupid content tracker
11enum Opt {
12 /// fetch branches from remote repository
13 Fetch {
14 #[structopt(long)]
15 dry_run: bool,
16 #[structopt(long)]
17 all: bool,
18 #[structopt(default_value = "origin")]
19 repository: String,
20 },
21 #[structopt(help = "add files to the staging area")]
22 Add {
23 #[structopt(short)]
24 interactive: bool,
25 #[structopt(short)]
26 all: bool,
27 files: Vec<String>,
28 },
29}
30
31fn main() {
32 let matches = Opt::from_args();
33
34 println!("{:?}", matches);
35}