summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 932d9af0144de8256324bc9798dd2f228258c5d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate clap;
extern crate colored;
extern crate rustyline;

use colored::*;
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")
            .value_name("FILE")
            .help("Media file to stream")
            .index(1)
            .required(true))
        .get_matches();

    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);
    }
}