formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-12-12 15:35:30 +01:00
parent 6d152f8930
commit f1fcdff9a3
3 changed files with 3 additions and 10 deletions

View File

@ -107,11 +107,7 @@ impl CliCommandMap {
}
/// Insert another command.
pub fn insert<C: Into<CommandLineInterface>>(
mut self,
name: &'static str,
cli: C,
) -> Self {
pub fn insert<C: Into<CommandLineInterface>>(mut self, name: &'static str, cli: C) -> Self {
self.commands.insert(name.into(), cli.into());
self
}

View File

@ -212,7 +212,6 @@ pub fn handle_command(
/// - ``printdoc``: Output ReST documentation.
///
pub fn run_cli_command<C: Into<CommandLineInterface>>(def: C) {
let def = match def.into() {
CommandLineInterface::Simple(cli_cmd) => CommandLineInterface::Simple(cli_cmd),
CommandLineInterface::Nested(map) => CommandLineInterface::Nested(map.insert_help()),

View File

@ -337,13 +337,11 @@ mod test {
.insert("l0c1", CliCommand::new(&API_METHOD_SIMPLE1))
.insert(
"l0c2",
CliCommand::new(&API_METHOD_SIMPLE1)
.arg_param(&["required-arg"])
CliCommand::new(&API_METHOD_SIMPLE1).arg_param(&["required-arg"]),
)
.insert(
"l0c3",
CliCommand::new(&API_METHOD_SIMPLE1)
.arg_param(&["required-arg", "optional-arg"])
CliCommand::new(&API_METHOD_SIMPLE1).arg_param(&["required-arg", "optional-arg"]),
);
cmd_def.into()