deltamap 0.2.2

A simple map viewer
use clap;
use clap::Arg;


pub fn parse<'a>() -> clap::ArgMatches<'a> {
    clap::App::new("DeltaMap")
        .version(crate_version!())
        .author(crate_authors!())
        .about(crate_description!())
        .arg(Arg::with_name("config")
            .short("c")
            .long("config")
            .value_name("FILE")
            .help("Set a custom config file")
            .takes_value(true))
        .arg(Arg::with_name("list-paths")
            .long("list-paths")
            .help("Print paths of configuration files and directories \
                and exit the program."))
        .arg(Arg::with_name("tile-sources")
            .short("t")
            .long("tile-sources")
            .value_name("FILE")
            .help("Set a custom tile sources file")
            .takes_value(true))
        .arg(Arg::with_name("pbf")
            .long("pbf")
            .value_name("FILE")
            .help("Set a *.osm.pbf file")
            .takes_value(true))
        .arg(Arg::with_name("search")
            .short("s")
            .long("search")
            .value_name("PATTERN")
            .number_of_values(1)
            .multiple(true)
            .help("Search for places which match the given pattern")
            .takes_value(true))
        .arg(Arg::with_name("keyval")
            .short("k")
            .long("keyval")
            .value_names(&["KEY", "VALUE"])
            .number_of_values(2)
            .multiple(true)
            .help("Search for places that are tagged with the given key and value")
            .takes_value(true))
        .arg(Arg::with_name("keyvalregex")
            .short("r")
            .long("keyvalregex")
            .value_names(&["KEY", "REGEX"])
            .number_of_values(2)
            .multiple(true)
            .help("Search for places that are tagged with the given key and a value that matches the given regex")
            .takes_value(true))
        .arg(Arg::with_name("fps")
            .long("fps")
            .value_name("FPS")
            .validator(|s| {
                s.parse::<f64>()
                    .map(|_| ())
                    .map_err(|e| format!("{}", e))
            })
            .help("Set target frames per second (default is 60). \
                This should equal the refresh rate of the display.")
            .takes_value(true))
        .arg(Arg::with_name("offline")
            .long("offline")
            .help("Do not use the network. \
                Try to load tiles from the offline file system cache."))
        .arg(Arg::with_name("sync")
            .long("sync")
            .help("Load tiles in a synchronous fashion. \
                The UI is blocked while tiles are loading."))
        .get_matches()
}