use clap::{Arg}; use clap_nested::{Commander}; mod command; mod lib; const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION"); fn main() { match Commander::new() .options(|app| { app.name("Walkman Tools") .version(VERSION.unwrap_or("UNKNOWN")) .author("Drew Short ") .about("Management tool for walkman mp3 players") .arg( Arg::with_name("verbose") .short("v") .long("verbose") .global(true) .takes_value(true) .value_name("VERBOSITY") .help("Sets the logging verbosity, defaults to \"INFO\""), ) }) .args(|_args, matches| matches.value_of("verbose").unwrap_or("INFO")) .add_cmd(command::dedupe::get_command()) .no_cmd(|_args, _matches| { println!("No subcommand matched"); Ok(()) }) .run() { Ok(_) => std::process::exit(0), Err(err) => println!("{}", err) } }