These are chat archives for kbknapp/clap-rs

11th
Jul 2018
matrixbot
@matrixbot
Jul 11 2018 22:43
Refpga Hello, I'm trying to parse a path from an option argument. The return value of ArgMatches::value_of is Option, so I parse that using match, but the branch of match that always gets evaluated is None. That is, I never get the value of the path. See the Following code.
let binpath: PathBuf = PathBuf::from(String::from(match matches.value_of("binpath") {
    Some(path) => path,
    None => {
        eprintln!("Error: Can't parse the path for Executable Binary.");
        process::exit(1);
    }
}));
matrixbot
@matrixbot
Jul 11 2018 22:48
Refpga Relevant part from clap App instantiation.
.arg(Arg::with_name("binpath")
                            .short("i")
                            .help("Path to the Executable Binary.")
                            .long("input-file")
                            .takes_value(true)
                            .required(true))