From e8e9bae4d1565caff0fa7c940a70a0f7669c20c9 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 2 Dec 2019 11:04:40 +0100 Subject: [PATCH] src/bin/completion.rs: add echo command --- src/bin/completion.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/bin/completion.rs b/src/bin/completion.rs index cf9376e11..5108b4e30 100644 --- a/src/bin/completion.rs +++ b/src/bin/completion.rs @@ -4,6 +4,26 @@ use proxmox::api::*; use proxmox_backup::cli::*; +#[api( + input: { + properties: { + text: { + type: String, + description: "Some text.", + } + } + }, +)] +/// Echo command. Print the passed text. +/// +/// Returns: nothing +fn echo_command( + text: String, +) -> Result<(), Error> { + println!("{}", text); + Ok(()) +} + #[api( input: { properties: { @@ -45,6 +65,8 @@ fn cli_definition() -> CommandLineInterface { let cmd_def = CliCommandMap::new() .insert("quit", CliCommand::new(&API_METHOD_QUIT_COMMAND).into()) .insert("hello", CliCommand::new(&API_METHOD_HELLO_COMMAND).into()) + .insert("echo", CliCommand::new(&API_METHOD_ECHO_COMMAND) + .arg_param(&["text"]).into()) .insert_help(); CommandLineInterface::Nested(cmd_def)