diff --git a/src/command/dedupe.rs b/src/command/dedupe.rs index 83f533a..8cbaa43 100644 --- a/src/command/dedupe.rs +++ b/src/command/dedupe.rs @@ -1,10 +1,28 @@ +use clap::{Arg, Error, ErrorKind}; use clap_nested::{Command}; pub fn get_command<'a>() -> Command<'a, str>{ Command::new("dedupe") .description("dedupe a m3u playlist") - .runner(| args, _matches| { - println!("Running dedupe, logging = {}", args); - Ok(()) + .options(|app| { + app.arg(Arg::with_name("playlist") + .help("Path of the playlist(s) to de-duplicate") + .index(1) + .multiple(true) + .required(true) + ) + }) + .runner(| _args, matches| { + // println!("Running dedupe, logging = {}", args); + match matches.values_of("playlist") { + Some(playlists) => { + for playlist in playlists { + println!("{}", playlist) + } + Ok(()) + }, + None => Err( + Error::with_description("playlist must be provided", ErrorKind::EmptyValue)) + } }) }