2017-07-04 21:59:27 +00:00
|
|
|
//! `git.rs` serves as a demonstration of how to use subcommands,
|
|
|
|
//! as well as a demonstration of adding documentation to subcommands.
|
2020-01-07 10:17:23 +00:00
|
|
|
//! Documentation can be added either through doc comments or
|
|
|
|
//! `help`/`about` attributes.
|
2017-07-04 21:59:27 +00:00
|
|
|
|
2021-07-13 17:50:55 +00:00
|
|
|
use clap::Parser;
|
2017-07-04 21:59:27 +00:00
|
|
|
|
2021-07-13 17:50:55 +00:00
|
|
|
#[derive(Parser, Debug)]
|
2018-07-02 18:45:17 +00:00
|
|
|
#[clap(name = "git")]
|
2017-07-04 21:59:27 +00:00
|
|
|
/// the stupid content tracker
|
|
|
|
enum Opt {
|
|
|
|
/// fetch branches from remote repository
|
|
|
|
Fetch {
|
2020-01-07 10:17:23 +00:00
|
|
|
#[clap(long)]
|
2017-07-04 21:59:27 +00:00
|
|
|
dry_run: bool,
|
2020-01-07 10:17:23 +00:00
|
|
|
#[clap(long)]
|
2017-07-04 21:59:27 +00:00
|
|
|
all: bool,
|
2018-07-02 18:45:17 +00:00
|
|
|
#[clap(default_value = "origin")]
|
2018-05-21 14:54:22 +00:00
|
|
|
repository: String,
|
2017-07-04 21:59:27 +00:00
|
|
|
},
|
2020-01-07 10:17:23 +00:00
|
|
|
#[clap(override_help = "add files to the staging area")]
|
2017-07-04 21:59:27 +00:00
|
|
|
Add {
|
2020-01-07 10:17:23 +00:00
|
|
|
#[clap(short)]
|
2017-07-04 21:59:27 +00:00
|
|
|
interactive: bool,
|
2020-01-07 10:17:23 +00:00
|
|
|
#[clap(short)]
|
2017-07-04 21:59:27 +00:00
|
|
|
all: bool,
|
2018-05-21 14:54:22 +00:00
|
|
|
files: Vec<String>,
|
|
|
|
},
|
2017-07-04 21:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2018-07-02 18:45:17 +00:00
|
|
|
let matches = Opt::parse();
|
2017-07-04 21:59:27 +00:00
|
|
|
|
|
|
|
println!("{:?}", matches);
|
|
|
|
}
|