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.
43 lines
1.3 KiB
43 lines
1.3 KiB
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 <warrick@sothr.com>")
|
|
.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\""),
|
|
)
|
|
.arg(
|
|
Arg::with_name("dry-run")
|
|
.long("dry-run")
|
|
.global(true)
|
|
.takes_value(false)
|
|
.help("Make no changes and print expected output")
|
|
)
|
|
})
|
|
.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)
|
|
}
|
|
}
|