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.

31 lines
1.0 KiB

use clap::{Arg, Error, ErrorKind};
use clap_nested::{Command};
use crate::lib::m3u::{Playlist};
pub fn get_command<'a>() -> Command<'a, str>{
Command::new("dedupe")
.description("dedupe a m3u playlist")
.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 path in playlists {
let playlist = Playlist::read(path)?;
println!("{:?}", playlist);
}
Ok(())
},
None => Err(
Error::with_description("playlist must be provided", ErrorKind::EmptyValue))
}
})
}