diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 408094a..932d9af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,21 +3,31 @@ extern crate colored; extern crate rustyline; use colored::*; -use clap::{Arg, App, SubCommand}; -use rustyline::error::ReadlineError; -use rustyline::Editor; +use clap::{Arg, App}; +// use rustyline::error::ReadlineError; +// use rustyline::Editor; +use std::path::Path; +use std::process; fn main() { let matches = App::new("Rustcast") .version("0.1") .author("Yuval Adam") .about("A simple UPnP/DLNA casting player") - .arg(Arg::with_name("file") + .arg(Arg::with_name("FILE") .value_name("FILE") .help("Media file to stream") .index(1) .required(true)) .get_matches(); - //println!("\n{}", "Rustcast v0.1.0".color("blue").bold()); - //println!("\n usage: rustcast <media.file>\n"); + + let infile = matches.value_of("FILE").unwrap(); + + if Path::new(infile).exists() { + println!("\n{} {}\n", "Using input file:".green(), infile.green()); + } + else { + println!("\n{} {}\n", "Input file does not exist:".red(), infile.red()); + process::exit(1); + } } |
