summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
blob: 4e1d7cb6bb71a5004acb7eb33d431fc849619db8 (plain) (blame)
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
use clap;

const _DUMMY_DEPENDENCY: &'static str = include_str!("../Cargo.toml");

pub struct Options {
    pub username: String,
    pub api_key: String,
}

pub fn get_options() -> Options {
    let matches = app_from_crate!()
        .arg(
            clap::Arg::with_name("username")
                .required(true)
                .help("last.fm username to fetch tracks for")
        )
        .arg(
            clap::Arg::with_name("api_key")
                .required(true)
                .help("last.fm api key")
        )
        .get_matches();

    Options {
        username: matches.value_of("username").unwrap().to_string(),
        api_key: matches.value_of("api_key").unwrap().to_string(),
    }
}