diff options
| author | Nathan Jaremko | 2018-11-19 10:36:42 -0500 | 
|---|---|---|
| committer | Nathan Jaremko | 2018-11-19 10:36:42 -0500 | 
| commit | 118b36cbf32024f16ab7db4f1ad0b1a29b7592f5 (patch) | |
| tree | f4d4b40f20ec10ec3526bdf239a1995e6830ac36 /src/main.rs | |
| parent | 714e8ded029907c1d8639121a3d171344808a5d5 (diff) | |
| download | podcast-118b36cbf32024f16ab7db4f1ad0b1a29b7592f5.tar.bz2 | |
Upgrade to rust 2018
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 34 | 
1 files changed, 19 insertions, 15 deletions
| diff --git a/src/main.rs b/src/main.rs index 2e07e08..c3ad6c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,9 @@ +#![feature(nll)]  #![recursion_limit = "1024"]  extern crate chrono;  extern crate clap; +extern crate dirs;  #[macro_use]  extern crate error_chain;  #[macro_use] @@ -16,22 +18,22 @@ extern crate serde_json;  extern crate toml;  extern crate yaml_rust; -mod actions; -mod structs; -mod utils; -mod errors { +pub mod actions; +pub mod structs; +pub mod utils; +pub mod errors {      // Create the Error, ErrorKind, ResultExt, and Result types      error_chain!{}  } -use actions::*; -use errors::*; -use structs::*; -use utils::*; +use self::actions::*; +use self::errors::*; +use self::structs::*; +use self::utils::*;  use clap::{App, Arg, SubCommand}; -const VERSION: &str = "0.5.10"; +const VERSION: &str = "0.6.0";  fn main() -> Result<()> {      create_directories().chain_err(|| "unable to create directories")?; @@ -138,18 +140,20 @@ fn main() -> Result<()> {                  .value_of("PODCAST")                  .chain_err(|| "unable to find subcommand match")?;              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("ls") | Some("list") => {              let list_matches = matches                  .subcommand_matches("ls") -                .or(matches.subcommand_matches("list")) +                .or_else(|| matches.subcommand_matches("list"))                  .chain_err(|| "unable to find subcommand matches")?;              match list_matches.value_of("PODCAST") {                  Some(regex) => list_episodes(regex)?, | 
