You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1008 B

4 years ago
  1. use clap::{Arg};
  2. use clap_nested::{Commander};
  3. mod command;
  4. fn main() {
  5. match Commander::new()
  6. .options(|app| {
  7. app.name("Walkman Tools")
  8. .version("1.0")
  9. .author("Drew Short <warrick@sothr.com>")
  10. .about("Management tool for walkman mp3 players")
  11. .arg(
  12. Arg::with_name("verbose")
  13. .short("v")
  14. .long("verbose")
  15. .global(true)
  16. .takes_value(true)
  17. .value_name("VERBOSITY")
  18. .help("Sets the logging verbosity, defaults to \"INFO\""),
  19. )
  20. })
  21. .args(|_args, matches| matches.value_of("verbose").unwrap_or("INFO"))
  22. .add_cmd(command::dedupe::get_command())
  23. .no_cmd(|_args, _matches| {
  24. println!("No subcommand matched");
  25. Ok(())
  26. })
  27. .run() {
  28. Ok(result) => std::process::exit(0),
  29. Err(err) => println!("{}", err)
  30. }
  31. }