src/bin/proxmox-backup-client.rs: fix bash completion
This commit is contained in:
parent
741706eefe
commit
f98ea63de2
@ -212,6 +212,24 @@ fn create_backup(
|
|||||||
//datastore.garbage_collection()?;
|
//datastore.garbage_collection()?;
|
||||||
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn complete_backup_source(arg: &str) -> Vec<String> {
|
||||||
|
|
||||||
|
let mut result = vec![];
|
||||||
|
|
||||||
|
let data: Vec<&str> = arg.splitn(2, ':').collect();
|
||||||
|
|
||||||
|
if data.len() != 2 { return result; }
|
||||||
|
|
||||||
|
let files = tools::complete_file_name(data[1]);
|
||||||
|
|
||||||
|
for file in files {
|
||||||
|
result.push(format!("{}:{}", data[0], file));
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -250,7 +268,7 @@ fn main() {
|
|||||||
)
|
)
|
||||||
))
|
))
|
||||||
.arg_param(vec!["repository", "backupspec"])
|
.arg_param(vec!["repository", "backupspec"])
|
||||||
.completion_cb("backupspec", tools::complete_file_name);
|
.completion_cb("backupspec", complete_backup_source);
|
||||||
|
|
||||||
let list_cmd_def = CliCommand::new(
|
let list_cmd_def = CliCommand::new(
|
||||||
ApiMethod::new(
|
ApiMethod::new(
|
||||||
|
Loading…
Reference in New Issue
Block a user