imag-ref: Use validator is_existing_path

This commit is contained in:
Matthias Beyer 2016-09-30 10:47:38 +02:00
parent f8ed44c1e7
commit 4d2ac38ceb

View file

@ -1,5 +1,7 @@
use clap::{Arg, App, SubCommand}; use clap::{Arg, App, SubCommand};
use libimagutil::cli_validators::is_existing_path;
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
app app
.subcommand(SubCommand::with_name("add") .subcommand(SubCommand::with_name("add")
@ -11,6 +13,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("The path of the file") .help("The path of the file")
.validator(is_existing_path)
.value_name("PATH")) .value_name("PATH"))
.arg(Arg::with_name("track-content") .arg(Arg::with_name("track-content")
.long("content-hash") .long("content-hash")