mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(clap): print usage if command is missing
Also, fixed config-dir substitution in flag's help message
This commit is contained in:
@@ -104,7 +104,7 @@ Configuration:
|
||||
CONFIG_DIR_FLAG,
|
||||
"A directory into which we will store our persistent data. Defaults to "
|
||||
"a user-writable directory that we will create during the first invocation."
|
||||
"[default: ${CONFIG_DIR}]",
|
||||
"[default: %s" % CONFIG_DIR,
|
||||
'folder',
|
||||
))
|
||||
|
||||
|
||||
@@ -69,12 +69,14 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
% endfor # each method
|
||||
_ => {
|
||||
err.issues.push(CLIError::MissingMethodError("${mangle_subcommand(resource)}".to_string()));
|
||||
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
|
||||
}
|
||||
}
|
||||
},
|
||||
% endfor # each resource
|
||||
_ => {
|
||||
err.issues.push(CLIError::MissingCommandError);
|
||||
writeln!(io::stderr(), "{}\n", ${SOPT}.usage()).ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ impl fmt::Display for CLIError {
|
||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
||||
},
|
||||
CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command"),
|
||||
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the {} command", cmd),
|
||||
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command", cmd),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user