Browse Source

Added scaffold for processing multiple playlists

master
Drew Short 5 years ago
parent
commit
4690e19f1b
  1. 24
      src/command/dedupe.rs

24
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))
}
})
}
Loading…
Cancel
Save