diff options
| author | Nathan Jaremko | 2018-03-22 00:10:33 -0400 | 
|---|---|---|
| committer | Nathan Jaremko | 2018-03-22 00:10:33 -0400 | 
| commit | 829f9fca259034d1a63173bb19e43b1c24c3face (patch) | |
| tree | 8b59381393f1e41b994afe9a4b25af9ed0309629 /src/main.rs | |
| parent | 7a110aa9098c5fa2c772dd5f4dcc93ef3322de00 (diff) | |
| download | podcast-829f9fca259034d1a63173bb19e43b1c24c3face.tar.bz2 | |
Fix ls/list to allow piping
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 20 | 
1 files changed, 16 insertions, 4 deletions
| diff --git a/src/main.rs b/src/main.rs index fef188e..7f88d32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ use structs::*;  use clap::{App, Arg, SubCommand}; -const VERSION: &str = "0.5.1"; +const VERSION: &str = "0.5.2";  fn main() {      if let Err(err) = create_directories() { @@ -60,11 +60,20 @@ fn main() {                  ),          )          .subcommand( -            SubCommand::with_name("play") +            SubCommand::with_name("list")                  .about("list episodes of podcast")                  .arg(                      Arg::with_name("PODCAST")                          .help("Regex for subscribed podcast") +                        .index(1), +                ), +        ) +        .subcommand( +            SubCommand::with_name("play") +                .about("play an episode") +                .arg( +                    Arg::with_name("PODCAST") +                        .help("Regex for subscribed podcast")                          .required(true)                          .index(1),                  ) @@ -131,8 +140,11 @@ fn main() {                  None => download_all(&state, podcast),              }          } -        Some("ls") => { -            let list_matches = matches.subcommand_matches("ls").unwrap(); +        Some("ls") | Some("list") => { +            let list_matches = matches +                .subcommand_matches("ls") +                .or(matches.subcommand_matches("list")) +                .unwrap();              match list_matches.value_of("PODCAST") {                  Some(regex) => list_episodes(regex),                  None => list_subscriptions(&state), | 
