| 1 | use clap::{Arg, ArgAction, Command, crate_version, value_parser}; |
| 2 | |
| 3 | pub fn app() -> Command { |
| 4 | let arg_with_fzf = Arg::new("with-fzf") |
| 5 | .long("with-fzf") |
| 6 | .short('f') |
| 7 | .num_args(0) |
| 8 | .action(ArgAction::SetTrue) |
| 9 | .help("Integrate with fzf"); |
| 10 | let arg_with_skim = Arg::new("with-skim") |
| 11 | .long("with-skim") |
| 12 | .short('s') |
| 13 | .help("Integrate with skim") |
| 14 | .conflicts_with("with-fzf") |
| 15 | .action(ArgAction::SetTrue) |
| 16 | .num_args(0); |
| 17 | |
| 18 | Command::new("fw") |
| 19 | .version(crate_version!()) |
| 20 | .author("Brocode <bros@brocode.sh>") |
| 21 | .about( |
| 22 | "fast workspace manager. Config set by FW_CONFIG_DIR or default. |
| 23 | For further information please have a look at our README https://github.com/brocode/fw/blob/master/README.org", |
| 24 | ) |
| 25 | .subcommand_required(true) |
| 26 | .subcommand( |
| 27 | Command::new("sync") |
| 28 | .about("Sync workspace. Clones projects or updates remotes for existing projects.") |
| 29 | .arg( |
| 30 | Arg::new("tag") |
| 31 | .long("tag") |
| 32 | .short('t') |
| 33 | .help("Filter projects by tag. More than 1 is allowed.") |
| 34 | .required(false) |
| 35 | .num_args(1) |
| 36 | .action(ArgAction::Append), |
| 37 | ) |
| 38 | .arg( |
| 39 | Arg::new("no-fast-forward-merge") |
| 40 | .long("no-ff-merge") |
| 41 | .help("No fast forward merge") |
| 42 | .action(ArgAction::SetTrue) |
| 43 | .num_args(0), |
| 44 | ) |
| 45 | .arg( |
| 46 | Arg::new("only-new") |
| 47 | .long("only-new") |
| 48 | .short('n') |
| 49 | .help("Only clones projects. Skips all actions for projects already on your machine.") |
| 50 | .num_args(0) |
| 51 | .action(ArgAction::SetTrue), |
| 52 | ) |
| 53 | .arg( |
| 54 | Arg::new("parallelism") |
| 55 | .long("parallelism") |
| 56 | .short('p') |
| 57 | .default_value("8") |
| 58 | .value_parser(clap::builder::RangedI64ValueParser::<i32>::new().range(0..=128)) |
| 59 | .help("Sets the count of worker") |
| 60 | .num_args(1), |