Skip to content

Instantly share code, notes, and snippets.

@ssrlive
Created October 2, 2022 23:29
Show Gist options
  • Save ssrlive/19b24d307409e5cfa294985be52b0384 to your computer and use it in GitHub Desktop.
Save ssrlive/19b24d307409e5cfa294985be52b0384 to your computer and use it in GitHub Desktop.
use structopt::StructOpt;
#[derive(StructOpt, PartialEq, Eq, Debug)]
enum Opt {
/// Fetch stuff from GitHub
Fetch {
#[structopt(short, long)]
/// Fetch all the repository contents
all: bool,
#[structopt(short, long)]
/// Overwrite local branches.
force: bool,
repo: String,
},
/// Add new changes to the repository
Add {
#[structopt(short, long)]
/// Interactive mode.
interactive: bool,
#[structopt(short, long)]
/// Verbose mode.
verbose: bool,
},
}
fn main() {
let opt = Opt::from_args();
println!("{:?}", opt);
}
// source: https://github.com/TeXitoi/structopt/blob/master/tests/subcommands.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment