diff options
author | Jon Moroney <darakian@gmail.com> | 2022-01-23 14:34:47 -0800 |
---|---|---|
committer | Jon Moroney <darakian@gmail.com> | 2022-01-23 14:34:47 -0800 |
commit | 5e14d491ea523e6e9f9462ffd436cea052bf560c (patch) | |
tree | d62265b59f3aff8d7e9aca16560c042c1f025f5b | |
parent | 2b5cce4dbcf982ea9383b770f56cf9b5a98b24ef (diff) |
Migrate to clap 3, move about to a static and remove positionality from directories arg
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 31 |
2 files changed, 17 insertions, 16 deletions
@@ -11,7 +11,7 @@ documentation = "https://docs.rs/ddh" readme = "README.md" [dependencies] -clap = "2.33" +clap = "3" rayon = "1.4" serde = "1.0" serde_json = "1.0" diff --git a/src/main.rs b/src/main.rs index 9a4fb76..54bb0ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,43 +19,44 @@ pub enum Verbosity { All, } +static DDH_ABOUT: &str = "Compare and contrast directories.\nExample invocation: ddh /home/jon/downloads /home/jon/documents -f duplicates\nExample pipe: ddh ~/Downloads/ -o no -v all -f json | someJsonParser.bin"; + fn main() { let arguments = App::new("Directory Difference hTool") .version(env!("CARGO_PKG_VERSION")) .author(env!("CARGO_PKG_AUTHORS")) - .about("Compare and contrast directories.\nExample invocation: ddh /home/jon/downloads /home/jon/documents -f duplicates\nExample pipe: ddh ~/Downloads/ -o no -v all -f json | someJsonParser.bin") - .arg(Arg::with_name("directories") - .short("d") + .about(DDH_ABOUT) + .arg(Arg::new("directories") + .short('d') .long("directories") .value_name("Directories") .help("Directories to parse") .min_values(1) .required(true) - .takes_value(true) - .index(1)) - .arg(Arg::with_name("Blocksize") - .short("bs") + .takes_value(true)) + .arg(Arg::new("Blocksize") + .short('b') .long("blocksize") - .case_insensitive(true) + .ignore_case(true) .takes_value(true) .max_values(1) .possible_values(&["B", "K", "M", "G"]) .help("Sets the display blocksize to Bytes, Kilobytes, Megabytes or Gigabytes. Default is Kilobytes.")) - .arg(Arg::with_name("Verbosity") - .short("v") + .arg(Arg::new("Verbosity") + .short('v') .long("verbosity") .possible_values(&["quiet", "duplicates", "all"]) - .case_insensitive(true) + .ignore_case(true) .takes_value(true) .help("Sets verbosity for printed output.")) - .arg(Arg::with_name("Output") - .short("o") + .arg(Arg::new("Output") + .short('o') .long("output") .takes_value(true) .max_values(1) .help("Sets file to save all output. Use 'no' for no file output.")) - .arg(Arg::with_name("Format") - .short("f") + .arg(Arg::new("Format") + .short('f') .long("format") .possible_values(&["standard", "json", "off"]) .takes_value(true) |