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.

35 lines
1.1 KiB

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