cli: avoid useless .into()
This needs latest proxmox-api updates.
This commit is contained in:
parent
eb7e2ee00b
commit
48ef3c3327
|
@ -28,59 +28,52 @@ pub struct Shell {
|
||||||
pub fn catalog_shell_cli() -> CommandLineInterface {
|
pub fn catalog_shell_cli() -> CommandLineInterface {
|
||||||
|
|
||||||
let map = CliCommandMap::new()
|
let map = CliCommandMap::new()
|
||||||
.insert("pwd", CliCommand::new(&API_METHOD_PWD_COMMAND).into())
|
.insert("pwd", CliCommand::new(&API_METHOD_PWD_COMMAND))
|
||||||
.insert(
|
.insert(
|
||||||
"cd",
|
"cd",
|
||||||
CliCommand::new(&API_METHOD_CD_COMMAND)
|
CliCommand::new(&API_METHOD_CD_COMMAND)
|
||||||
.arg_param(&["path"])
|
.arg_param(&["path"])
|
||||||
.completion_cb("path", Shell::complete_path)
|
.completion_cb("path", Shell::complete_path)
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
"ls",
|
"ls",
|
||||||
CliCommand::new(&API_METHOD_LS_COMMAND)
|
CliCommand::new(&API_METHOD_LS_COMMAND)
|
||||||
.arg_param(&["path"])
|
.arg_param(&["path"])
|
||||||
.completion_cb("path", Shell::complete_path)
|
.completion_cb("path", Shell::complete_path)
|
||||||
.into(),
|
)
|
||||||
)
|
|
||||||
.insert(
|
.insert(
|
||||||
"stat",
|
"stat",
|
||||||
CliCommand::new(&API_METHOD_STAT_COMMAND)
|
CliCommand::new(&API_METHOD_STAT_COMMAND)
|
||||||
.arg_param(&["path"])
|
.arg_param(&["path"])
|
||||||
.completion_cb("path", Shell::complete_path)
|
.completion_cb("path", Shell::complete_path)
|
||||||
.into(),
|
)
|
||||||
)
|
|
||||||
.insert(
|
.insert(
|
||||||
"select",
|
"select",
|
||||||
CliCommand::new(&API_METHOD_SELECT_COMMAND)
|
CliCommand::new(&API_METHOD_SELECT_COMMAND)
|
||||||
.arg_param(&["path"])
|
.arg_param(&["path"])
|
||||||
.completion_cb("path", Shell::complete_path)
|
.completion_cb("path", Shell::complete_path)
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
"deselect",
|
"deselect",
|
||||||
CliCommand::new(&API_METHOD_DESELECT_COMMAND)
|
CliCommand::new(&API_METHOD_DESELECT_COMMAND)
|
||||||
.arg_param(&["path"])
|
.arg_param(&["path"])
|
||||||
.completion_cb("path", Shell::complete_path)
|
.completion_cb("path", Shell::complete_path)
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
"restore-selected",
|
"restore-selected",
|
||||||
CliCommand::new(&API_METHOD_RESTORE_SELECTED_COMMAND)
|
CliCommand::new(&API_METHOD_RESTORE_SELECTED_COMMAND)
|
||||||
.arg_param(&["target"])
|
.arg_param(&["target"])
|
||||||
.completion_cb("target", tools::complete_file_name)
|
.completion_cb("target", tools::complete_file_name)
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
"list-selected",
|
"list-selected",
|
||||||
CliCommand::new(&API_METHOD_LIST_SELECTED_COMMAND).into(),
|
CliCommand::new(&API_METHOD_LIST_SELECTED_COMMAND),
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
"restore",
|
"restore",
|
||||||
CliCommand::new(&API_METHOD_RESTORE_COMMAND)
|
CliCommand::new(&API_METHOD_RESTORE_COMMAND)
|
||||||
.arg_param(&["target"])
|
.arg_param(&["target"])
|
||||||
.completion_cb("target", tools::complete_file_name)
|
.completion_cb("target", tools::complete_file_name)
|
||||||
.into(),
|
|
||||||
)
|
)
|
||||||
.insert_help();
|
.insert_help();
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,11 @@ fn quit_command() -> Result<(), Error> {
|
||||||
|
|
||||||
fn cli_definition() -> CommandLineInterface {
|
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))
|
||||||
.insert("hello", CliCommand::new(&API_METHOD_HELLO_COMMAND).into())
|
.insert("hello", CliCommand::new(&API_METHOD_HELLO_COMMAND))
|
||||||
.insert("echo", CliCommand::new(&API_METHOD_ECHO_COMMAND)
|
.insert("echo", CliCommand::new(&API_METHOD_ECHO_COMMAND)
|
||||||
.arg_param(&["text"]).into())
|
.arg_param(&["text"])
|
||||||
|
)
|
||||||
.insert_help();
|
.insert_help();
|
||||||
|
|
||||||
CommandLineInterface::Nested(cmd_def)
|
CommandLineInterface::Nested(cmd_def)
|
||||||
|
|
|
@ -1651,10 +1651,10 @@ fn key_mgmt_cli() -> CliCommandMap {
|
||||||
.completion_cb("path", tools::complete_file_name);
|
.completion_cb("path", tools::complete_file_name);
|
||||||
|
|
||||||
CliCommandMap::new()
|
CliCommandMap::new()
|
||||||
.insert("create", key_create_cmd_def.into())
|
.insert("create", key_create_cmd_def)
|
||||||
.insert("create-master-key", key_create_master_key_cmd_def.into())
|
.insert("create-master-key", key_create_master_key_cmd_def)
|
||||||
.insert("import-master-pubkey", key_import_master_pubkey_cmd_def.into())
|
.insert("import-master-pubkey", key_import_master_pubkey_cmd_def)
|
||||||
.insert("change-passphrase", key_change_passphrase_cmd_def.into())
|
.insert("change-passphrase", key_change_passphrase_cmd_def)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mount(
|
fn mount(
|
||||||
|
@ -1945,8 +1945,8 @@ fn catalog_mgmt_cli() -> CliCommandMap {
|
||||||
.completion_cb("snapshot", complete_backup_snapshot);
|
.completion_cb("snapshot", complete_backup_snapshot);
|
||||||
|
|
||||||
CliCommandMap::new()
|
CliCommandMap::new()
|
||||||
.insert("dump", catalog_dump_cmd_def.into())
|
.insert("dump", catalog_dump_cmd_def)
|
||||||
.insert("shell", catalog_shell_cmd_def.into())
|
.insert("shell", catalog_shell_cmd_def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2285,23 +2285,23 @@ We do not extraxt '.pxar' archives when writing to stdandard output.
|
||||||
|
|
||||||
|
|
||||||
let cmd_def = CliCommandMap::new()
|
let cmd_def = CliCommandMap::new()
|
||||||
.insert("backup", backup_cmd_def.into())
|
.insert("backup", backup_cmd_def)
|
||||||
.insert("upload-log", upload_log_cmd_def.into())
|
.insert("upload-log", upload_log_cmd_def)
|
||||||
.insert("forget", forget_cmd_def.into())
|
.insert("forget", forget_cmd_def)
|
||||||
.insert("garbage-collect", garbage_collect_cmd_def.into())
|
.insert("garbage-collect", garbage_collect_cmd_def)
|
||||||
.insert("list", list_cmd_def.into())
|
.insert("list", list_cmd_def)
|
||||||
.insert("login", login_cmd_def.into())
|
.insert("login", login_cmd_def)
|
||||||
.insert("logout", logout_cmd_def.into())
|
.insert("logout", logout_cmd_def)
|
||||||
.insert("prune", prune_cmd_def.into())
|
.insert("prune", prune_cmd_def)
|
||||||
.insert("restore", restore_cmd_def.into())
|
.insert("restore", restore_cmd_def)
|
||||||
.insert("snapshots", snapshots_cmd_def.into())
|
.insert("snapshots", snapshots_cmd_def)
|
||||||
.insert("files", files_cmd_def.into())
|
.insert("files", files_cmd_def)
|
||||||
.insert("status", status_cmd_def.into())
|
.insert("status", status_cmd_def)
|
||||||
.insert("key", key_mgmt_cli().into())
|
.insert("key", key_mgmt_cli())
|
||||||
.insert("mount", mount_cmd_def.into())
|
.insert("mount", mount_cmd_def)
|
||||||
.insert("catalog", catalog_mgmt_cli().into());
|
.insert("catalog", catalog_mgmt_cli());
|
||||||
|
|
||||||
run_cli_command(cmd_def.into());
|
run_cli_command(cmd_def);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn async_main<F: Future>(fut: F) -> <F as Future>::Output {
|
fn async_main<F: Future>(fut: F) -> <F as Future>::Output {
|
||||||
|
|
|
@ -8,16 +8,16 @@ fn datastore_commands() -> CommandLineInterface {
|
||||||
use proxmox_backup::api2;
|
use proxmox_backup::api2;
|
||||||
|
|
||||||
let cmd_def = CliCommandMap::new()
|
let cmd_def = CliCommandMap::new()
|
||||||
.insert("list", CliCommand::new(&api2::config::datastore::GET).into())
|
.insert("list", CliCommand::new(&api2::config::datastore::GET))
|
||||||
.insert("create",
|
.insert("create",
|
||||||
CliCommand::new(&api2::config::datastore::POST)
|
CliCommand::new(&api2::config::datastore::POST)
|
||||||
.arg_param(&["name", "path"])
|
.arg_param(&["name", "path"])
|
||||||
.into())
|
)
|
||||||
.insert("remove",
|
.insert("remove",
|
||||||
CliCommand::new(&api2::config::datastore::DELETE)
|
CliCommand::new(&api2::config::datastore::DELETE)
|
||||||
.arg_param(&["name"])
|
.arg_param(&["name"])
|
||||||
.completion_cb("name", config::datastore::complete_datastore_name)
|
.completion_cb("name", config::datastore::complete_datastore_name)
|
||||||
.into());
|
);
|
||||||
|
|
||||||
cmd_def.into()
|
cmd_def.into()
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,12 @@ fn garbage_collection_commands() -> CommandLineInterface {
|
||||||
CliCommand::new(&api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS)
|
CliCommand::new(&api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS)
|
||||||
.arg_param(&["store"])
|
.arg_param(&["store"])
|
||||||
.completion_cb("store", config::datastore::complete_datastore_name)
|
.completion_cb("store", config::datastore::complete_datastore_name)
|
||||||
.into())
|
)
|
||||||
.insert("start",
|
.insert("start",
|
||||||
CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
|
CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
|
||||||
.arg_param(&["store"])
|
.arg_param(&["store"])
|
||||||
.completion_cb("store", config::datastore::complete_datastore_name)
|
.completion_cb("store", config::datastore::complete_datastore_name)
|
||||||
.into());
|
);
|
||||||
|
|
||||||
cmd_def.into()
|
cmd_def.into()
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ fn garbage_collection_commands() -> CommandLineInterface {
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
let cmd_def = CliCommandMap::new()
|
let cmd_def = CliCommandMap::new()
|
||||||
.insert("datastore".to_owned(), datastore_commands())
|
.insert("datastore", datastore_commands())
|
||||||
.insert("garbage-collection".to_owned(), garbage_collection_commands());
|
.insert("garbage-collection", garbage_collection_commands());
|
||||||
|
|
||||||
run_cli_command(cmd_def.into());
|
run_cli_command(cmd_def);
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,26 +491,22 @@ fn main() {
|
||||||
.arg_param(&["archive", "source", "exclude"])
|
.arg_param(&["archive", "source", "exclude"])
|
||||||
.completion_cb("archive", tools::complete_file_name)
|
.completion_cb("archive", tools::complete_file_name)
|
||||||
.completion_cb("source", tools::complete_file_name)
|
.completion_cb("source", tools::complete_file_name)
|
||||||
.into()
|
|
||||||
)
|
)
|
||||||
.insert("extract", CliCommand::new(&API_METHOD_EXTRACT_ARCHIVE)
|
.insert("extract", CliCommand::new(&API_METHOD_EXTRACT_ARCHIVE)
|
||||||
.arg_param(&["archive", "pattern"])
|
.arg_param(&["archive", "pattern"])
|
||||||
.completion_cb("archive", tools::complete_file_name)
|
.completion_cb("archive", tools::complete_file_name)
|
||||||
.completion_cb("target", tools::complete_file_name)
|
.completion_cb("target", tools::complete_file_name)
|
||||||
.completion_cb("files-from", tools::complete_file_name)
|
.completion_cb("files-from", tools::complete_file_name)
|
||||||
.into()
|
)
|
||||||
)
|
|
||||||
.insert("mount", CliCommand::new(&API_METHOD_MOUNT_ARCHIVE)
|
.insert("mount", CliCommand::new(&API_METHOD_MOUNT_ARCHIVE)
|
||||||
.arg_param(&["archive", "mountpoint"])
|
.arg_param(&["archive", "mountpoint"])
|
||||||
.completion_cb("archive", tools::complete_file_name)
|
.completion_cb("archive", tools::complete_file_name)
|
||||||
.completion_cb("mountpoint", tools::complete_file_name)
|
.completion_cb("mountpoint", tools::complete_file_name)
|
||||||
.into()
|
|
||||||
)
|
)
|
||||||
.insert("list", CliCommand::new(&API_METHOD_DUMP_ARCHIVE)
|
.insert("list", CliCommand::new(&API_METHOD_DUMP_ARCHIVE)
|
||||||
.arg_param(&["archive"])
|
.arg_param(&["archive"])
|
||||||
.completion_cb("archive", tools::complete_file_name)
|
.completion_cb("archive", tools::complete_file_name)
|
||||||
.into()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
run_cli_command(cmd_def.into());
|
run_cli_command(cmd_def);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue