[pbs-devel] [PATCH proxmox-backup] pbs-client: fix bash autocompletion for archive-files

Lukas Wagner l.wagner at proxmox.com
Thu Oct 20 11:22:50 CEST 2022


Previously, autocompletion of archive names, for instance
in the case of

  $ proxmox-backup-client restore <snapshot> <TAB>

did not work if no namespace was provided via the --ns option.
The fix is to fall back to the root namespace if the option is
not provided by the user.

Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 pbs-client/src/tools/mod.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pbs-client/src/tools/mod.rs b/pbs-client/src/tools/mod.rs
index 50e76a49..fa1d5092 100644
--- a/pbs-client/src/tools/mod.rs
+++ b/pbs-client/src/tools/mod.rs
@@ -297,7 +297,10 @@ pub async fn complete_server_file_name_do(param: &HashMap<String, String>) -> Ve
             Ok(v) => v,
             _ => return result,
         },
-        _ => return result,
+        _ => {
+            // If no namespace flag is provided, we assume the root namespace
+            pbs_api_types::BackupNamespace::root()
+        }
     };
 
     let query = json_object_to_query(json!({
-- 
2.30.2






More information about the pbs-devel mailing list