src/bin/completion.rs: add echo command
This commit is contained in:
parent
19d7a59236
commit
e8e9bae4d1
|
@ -4,6 +4,26 @@ use proxmox::api::*;
|
||||||
|
|
||||||
use proxmox_backup::cli::*;
|
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(
|
#[api(
|
||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
|
@ -45,6 +65,8 @@ fn cli_definition() -> CommandLineInterface {
|
||||||
let cmd_def = CliCommandMap::new()
|
let cmd_def = CliCommandMap::new()
|
||||||
.insert("quit", CliCommand::new(&API_METHOD_QUIT_COMMAND).into())
|
.insert("quit", CliCommand::new(&API_METHOD_QUIT_COMMAND).into())
|
||||||
.insert("hello", CliCommand::new(&API_METHOD_HELLO_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();
|
.insert_help();
|
||||||
|
|
||||||
CommandLineInterface::Nested(cmd_def)
|
CommandLineInterface::Nested(cmd_def)
|
||||||
|
|
Loading…
Reference in New Issue