Created
October 2, 2022 23:29
-
-
Save ssrlive/19b24d307409e5cfa294985be52b0384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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