]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/bin/proxmox-backup-manager.rs
cli: avoid useless .into()
[proxmox-backup.git] / src / bin / proxmox-backup-manager.rs
index 0c315e2bd68eda35cc840a3c92519ddcfca9a0b6..15c2cf18dc5d318923bb1659718af38747966f77 100644 (file)
@@ -1,7 +1,6 @@
 extern crate proxmox_backup;
 
-//use proxmox_backup::api2;
-use proxmox_backup::cli::*;
+use proxmox::api::cli::*;
 
 fn datastore_commands() -> CommandLineInterface {
 
@@ -9,16 +8,16 @@ fn datastore_commands() -> CommandLineInterface {
     use proxmox_backup::api2;
 
     let cmd_def = CliCommandMap::new()
-        .insert("list", CliCommand::new(api2::config::datastore::get()).into())
+        .insert("list", CliCommand::new(&api2::config::datastore::GET))
         .insert("create",
-                CliCommand::new(api2::config::datastore::post())
-                .arg_param(vec!["name", "path"])
-                .into())
+                CliCommand::new(&api2::config::datastore::POST)
+                .arg_param(&["name", "path"])
+        )
         .insert("remove",
-                CliCommand::new(api2::config::datastore::delete())
-                .arg_param(vec!["name"])
+                CliCommand::new(&api2::config::datastore::DELETE)
+                .arg_param(&["name"])
                 .completion_cb("name", config::datastore::complete_datastore_name)
-                .into());
+        );
 
     cmd_def.into()
 }
@@ -32,15 +31,15 @@ fn garbage_collection_commands() -> CommandLineInterface {
 
     let cmd_def = CliCommandMap::new()
         .insert("status",
-                CliCommand::new(api2::admin::datastore::api_method_garbage_collection_status())
-                .arg_param(vec!["store"])
+                CliCommand::new(&api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS)
+                .arg_param(&["store"])
                 .completion_cb("store", config::datastore::complete_datastore_name)
-                .into())
+        )
         .insert("start",
-                CliCommand::new(api2::admin::datastore::api_method_start_garbage_collection())
-                .arg_param(vec!["store"])
+                CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
+                .arg_param(&["store"])
                 .completion_cb("store", config::datastore::complete_datastore_name)
-                .into());
+        );
 
     cmd_def.into()
 }
@@ -48,8 +47,8 @@ fn garbage_collection_commands() -> CommandLineInterface {
 fn main() {
 
     let cmd_def = CliCommandMap::new()
-        .insert("datastore".to_owned(), datastore_commands())
-        .insert("garbage-collection".to_owned(), garbage_collection_commands());
+        .insert("datastore", datastore_commands())
+        .insert("garbage-collection", garbage_collection_commands());
 
-    run_cli_command(cmd_def.into());
+    run_cli_command(cmd_def);
 }