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. /// Insert another command.
pub fn insert<C: Into<CommandLineInterface>>( pub fn insert<C: Into<CommandLineInterface>>(mut self, name: &'static str, cli: C) -> Self {
mut self,
name: &'static str,
cli: C,
) -> Self {
self.commands.insert(name.into(), cli.into()); self.commands.insert(name.into(), cli.into());
self self
} }

View File

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

View File

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