improve command line parser

This commit is contained in:
Dietmar Maurer
2018-11-30 12:10:26 +01:00
parent d42398666c
commit 73f29c34d7
2 changed files with 38 additions and 11 deletions

View File

@ -45,7 +45,7 @@ fn parse_argument(arg: &str) -> RawArgument {
pub fn parse_arguments(
args: &Vec<String>,
arg_param: &Vec<String>,
arg_param: &Vec<&'static str>,
schema: &ObjectSchema,
) -> Result<(Value,Vec<String>), ParameterError> {
@ -133,7 +133,7 @@ pub fn parse_arguments(
for i in 0..arg_param.len() {
if rest.len() > i {
data.push((arg_param[i].clone(), rest[i].clone()));
data.push((arg_param[i].to_string(), rest[i].clone()));
} else {
errors.push(format_err!("missing argument '{}'", arg_param[i]));
}