]> git.proxmox.com Git - proxmox-backup.git/commitdiff
src/bin/proxmox-backup-client.rs: impl. and use complete_pxar_archive_name
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Dec 2019 12:14:32 +0000 (13:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Dec 2019 12:14:32 +0000 (13:14 +0100)
src/bin/proxmox-backup-client.rs

index 8a01de2b54ba898ac6f2408dc0cd99f62d23ac8b..011065484cb8759436895e593a0b37480cdf0ad7 100644 (file)
@@ -1358,6 +1358,20 @@ fn complete_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<Stri
         .collect()
 }
 
+fn complete_pxar_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
+    complete_server_file_name(arg, param)
+        .iter()
+        .filter_map(|v| {
+            let name = strip_server_file_expenstion(&v);
+            if name.ends_with(".pxar") {
+                Some(name)
+            } else {
+                None
+            }
+        })
+        .collect()
+}
+
 fn complete_chunk_size(_arg: &str, _param: &HashMap<String, String>) -> Vec<String> {
 
     let mut result = vec![];
@@ -1895,7 +1909,7 @@ fn catalog_mgmt_cli() -> CliCommandMap {
     let catalog_shell_cmd_def = CliCommand::new(&API_METHOD_SHELL)
         .arg_param(&["snapshot", "archive-name"])
         .completion_cb("repository", complete_repository)
-        .completion_cb("archive-name", complete_archive_name)
+        .completion_cb("archive-name", complete_pxar_archive_name)
         .completion_cb("snapshot", complete_group_or_snapshot);
 
     #[sortable]
@@ -2251,7 +2265,7 @@ We do not extraxt '.pxar' archives when writing to stdandard output.
         .arg_param(&["snapshot", "archive-name", "target"])
         .completion_cb("repository", complete_repository)
         .completion_cb("snapshot", complete_group_or_snapshot)
-        .completion_cb("archive-name", complete_archive_name)
+        .completion_cb("archive-name", complete_pxar_archive_name)
         .completion_cb("target", tools::complete_file_name);