]> git.proxmox.com Git - proxmox-backup.git/blob - src/bin/proxmox-backup-manager.rs
cli: avoid useless .into()
[proxmox-backup.git] / src / bin / proxmox-backup-manager.rs
1 extern crate proxmox_backup;
2
3 use proxmox::api::cli::*;
4
5 fn datastore_commands() -> CommandLineInterface {
6
7 use proxmox_backup::config;
8 use proxmox_backup::api2;
9
10 let cmd_def = CliCommandMap::new()
11 .insert("list", CliCommand::new(&api2::config::datastore::GET))
12 .insert("create",
13 CliCommand::new(&api2::config::datastore::POST)
14 .arg_param(&["name", "path"])
15 )
16 .insert("remove",
17 CliCommand::new(&api2::config::datastore::DELETE)
18 .arg_param(&["name"])
19 .completion_cb("name", config::datastore::complete_datastore_name)
20 );
21
22 cmd_def.into()
23 }
24
25
26
27 fn garbage_collection_commands() -> CommandLineInterface {
28
29 use proxmox_backup::config;
30 use proxmox_backup::api2;
31
32 let cmd_def = CliCommandMap::new()
33 .insert("status",
34 CliCommand::new(&api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS)
35 .arg_param(&["store"])
36 .completion_cb("store", config::datastore::complete_datastore_name)
37 )
38 .insert("start",
39 CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
40 .arg_param(&["store"])
41 .completion_cb("store", config::datastore::complete_datastore_name)
42 );
43
44 cmd_def.into()
45 }
46
47 fn main() {
48
49 let cmd_def = CliCommandMap::new()
50 .insert("datastore", datastore_commands())
51 .insert("garbage-collection", garbage_collection_commands());
52
53 run_cli_command(cmd_def);
54 }