aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs63
1 files changed, 32 insertions, 31 deletions
diff --git a/src/main.rs b/src/main.rs
index 37da2eb..82961dc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,7 +4,6 @@ extern crate rayon;
extern crate regex;
extern crate reqwest;
extern crate rss;
-extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
@@ -15,7 +14,7 @@ mod structs;
mod utils;
use actions::*;
-use clap::{Arg, App, SubCommand};
+use clap::{App, Arg, SubCommand};
use structs::*;
use utils::*;
@@ -33,9 +32,9 @@ fn main() {
};
let config = Config::new();
let matches = App::new("podcast")
- .version("1.0")
+ .version("0.4")
.author("Nathan J. <njaremko@gmail.com>")
- .about("Does awesome things")
+ .about("A command line podcast manager")
.subcommand(
SubCommand::with_name("download")
.about("download episodes of podcast")
@@ -48,7 +47,7 @@ fn main() {
.arg(Arg::with_name("EPISODE").help("Episode index").index(2)),
)
.subcommand(
- SubCommand::with_name("list")
+ SubCommand::with_name("ls")
.about("list episodes of podcast")
.arg(
Arg::with_name("PODCAST")
@@ -75,9 +74,11 @@ fn main() {
.subcommand(
SubCommand::with_name("search")
.about("searches for podcasts")
- .arg(Arg::with_name("debug").short("d").help(
- "print debug information verbosely",
- )),
+ .arg(
+ Arg::with_name("debug")
+ .short("d")
+ .help("print debug information verbosely"),
+ ),
)
.subcommand(
SubCommand::with_name("subscribe")
@@ -89,9 +90,10 @@ fn main() {
.index(1),
),
)
- .subcommand(SubCommand::with_name("update").about(
- "update subscribed podcasts",
- ))
+ .subcommand(SubCommand::with_name("refresh").about("refresh subscribed podcasts"))
+ .subcommand(SubCommand::with_name("update").about("check for updates"))
+ .subcommand(SubCommand::with_name("rm").about("delete podcast"))
+ .subcommand(SubCommand::with_name("completions").about("install shell completions"))
.get_matches();
match matches.subcommand_name() {
@@ -99,18 +101,16 @@ fn main() {
let download_matches = matches.subcommand_matches("download").unwrap();
let podcast = download_matches.value_of("PODCAST").unwrap();
match download_matches.value_of("EPISODE") {
- Some(ep) => {
- if String::from(ep).contains(|c| c == '-' || c == ',') {
- download_range(&state, podcast, ep)
- } else {
- download_episode(&state, podcast, ep)
- }
- }
+ Some(ep) => if String::from(ep).contains(|c| c == '-' || c == ',') {
+ download_range(&state, podcast, ep)
+ } else {
+ download_episode(&state, podcast, ep)
+ },
None => download_all(&state, podcast),
}
}
- Some("list") => {
- let list_matches = matches.subcommand_matches("list").unwrap();
+ Some("ls") => {
+ let list_matches = matches.subcommand_matches("ls").unwrap();
match list_matches.value_of("PODCAST") {
Some(regex) => list_episodes(regex),
None => list_subscriptions(&state),
@@ -122,18 +122,19 @@ fn main() {
let episode = play_matches.value_of("EPISODE").unwrap();
play_episode(&state, podcast, episode);
}
- Some("subscribe") => {
- state.subscribe(
- matches
- .subcommand_matches("subscribe")
- .unwrap()
- .value_of("URL")
- .unwrap(),
- &config,
- )
- }
+ Some("subscribe") => state.subscribe(
+ matches
+ .subcommand_matches("subscribe")
+ .unwrap()
+ .value_of("URL")
+ .unwrap(),
+ &config,
+ ),
Some("search") => (),
- Some("update") => update_rss(&mut state),
+ Some("rm") => (),
+ Some("completions") => (),
+ Some("refresh") => update_rss(&mut state),
+ Some("update") => check_for_update(&mut state),
_ => (),
}
if let Err(err) = state.save() {