src/bin/proxmox_backup_client/mount.rs: fix img name completion
This commit is contained in:
parent
45f9b32e0f
commit
2995aedf1d
|
@ -1824,10 +1824,22 @@ fn complete_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<Stri
|
||||||
pub fn complete_pxar_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
pub fn complete_pxar_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||||
complete_server_file_name(arg, param)
|
complete_server_file_name(arg, param)
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|v| {
|
.filter_map(|name| {
|
||||||
let name = tools::format::strip_server_file_expenstion(&v);
|
if name.ends_with(".pxar.didx") {
|
||||||
if name.ends_with(".pxar") {
|
Some(tools::format::strip_server_file_expenstion(name))
|
||||||
Some(name)
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn complete_img_archive_name(arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||||
|
complete_server_file_name(arg, param)
|
||||||
|
.iter()
|
||||||
|
.filter_map(|name| {
|
||||||
|
if name.ends_with(".img.fidx") {
|
||||||
|
Some(tools::format::strip_server_file_expenstion(name))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ use crate::{
|
||||||
REPO_URL_SCHEMA,
|
REPO_URL_SCHEMA,
|
||||||
extract_repository_from_value,
|
extract_repository_from_value,
|
||||||
complete_pxar_archive_name,
|
complete_pxar_archive_name,
|
||||||
|
complete_img_archive_name,
|
||||||
complete_group_or_snapshot,
|
complete_group_or_snapshot,
|
||||||
complete_repository,
|
complete_repository,
|
||||||
record_repository,
|
record_repository,
|
||||||
|
@ -101,7 +102,7 @@ pub fn map_cmd_def() -> CliCommand {
|
||||||
.arg_param(&["snapshot", "archive-name"])
|
.arg_param(&["snapshot", "archive-name"])
|
||||||
.completion_cb("repository", complete_repository)
|
.completion_cb("repository", complete_repository)
|
||||||
.completion_cb("snapshot", complete_group_or_snapshot)
|
.completion_cb("snapshot", complete_group_or_snapshot)
|
||||||
.completion_cb("archive-name", complete_pxar_archive_name)
|
.completion_cb("archive-name", complete_img_archive_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unmap_cmd_def() -> CliCommand {
|
pub fn unmap_cmd_def() -> CliCommand {
|
||||||
|
|
Loading…
Reference in New Issue