client: add completion callbacks for ns parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
fb840eda4d
commit
4adb574d74
|
@ -15,11 +15,11 @@ use pbs_tools::crypt_config::CryptConfig;
|
|||
use pbs_tools::json::required_string_param;
|
||||
|
||||
use crate::{
|
||||
complete_backup_snapshot, complete_group_or_snapshot, complete_pxar_archive_name,
|
||||
complete_repository, connect, crypto_parameters, decrypt_key, dir_or_last_from_group,
|
||||
extract_repository_from_value, format_key_source, optional_ns_param, record_repository,
|
||||
BackupDir, BufferedDynamicReadAt, BufferedDynamicReader, CatalogReader, DynamicIndexReader,
|
||||
IndexFile, Shell, CATALOG_NAME, KEYFD_SCHEMA, REPO_URL_SCHEMA,
|
||||
complete_backup_snapshot, complete_group_or_snapshot, complete_namespace,
|
||||
complete_pxar_archive_name, complete_repository, connect, crypto_parameters, decrypt_key,
|
||||
dir_or_last_from_group, extract_repository_from_value, format_key_source, optional_ns_param,
|
||||
record_repository, BackupDir, BufferedDynamicReadAt, BufferedDynamicReader, CatalogReader,
|
||||
DynamicIndexReader, IndexFile, Shell, CATALOG_NAME, KEYFD_SCHEMA, REPO_URL_SCHEMA,
|
||||
};
|
||||
|
||||
#[api(
|
||||
|
@ -265,12 +265,14 @@ pub fn catalog_mgmt_cli() -> CliCommandMap {
|
|||
let catalog_shell_cmd_def = CliCommand::new(&API_METHOD_CATALOG_SHELL)
|
||||
.arg_param(&["snapshot", "archive-name"])
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("archive-name", complete_pxar_archive_name)
|
||||
.completion_cb("snapshot", complete_group_or_snapshot);
|
||||
|
||||
let catalog_dump_cmd_def = CliCommand::new(&API_METHOD_DUMP_CATALOG)
|
||||
.arg_param(&["snapshot"])
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot);
|
||||
|
||||
CliCommandMap::new()
|
||||
|
|
|
@ -32,8 +32,8 @@ use pbs_client::catalog_shell::Shell;
|
|||
use pbs_client::tools::{
|
||||
complete_archive_name, complete_auth_id, complete_backup_group, complete_backup_snapshot,
|
||||
complete_backup_source, complete_chunk_size, complete_group_or_snapshot,
|
||||
complete_img_archive_name, complete_pxar_archive_name, complete_repository, connect,
|
||||
connect_rate_limited, extract_repository_from_value,
|
||||
complete_img_archive_name, complete_namespace, complete_pxar_archive_name, complete_repository,
|
||||
connect, connect_rate_limited, extract_repository_from_value,
|
||||
key_source::{
|
||||
crypto_parameters, format_key_source, get_encryption_key_password, KEYFD_SCHEMA,
|
||||
KEYFILE_SCHEMA, MASTER_PUBKEY_FD_SCHEMA, MASTER_PUBKEY_FILE_SCHEMA,
|
||||
|
@ -1638,6 +1638,7 @@ fn main() {
|
|||
.completion_cb("keyfile", complete_file_name);
|
||||
|
||||
let list_cmd_def = CliCommand::new(&API_METHOD_LIST_BACKUP_GROUPS)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("repository", complete_repository);
|
||||
|
||||
let garbage_collect_cmd_def = CliCommand::new(&API_METHOD_START_GARBAGE_COLLECTION)
|
||||
|
@ -1646,12 +1647,14 @@ fn main() {
|
|||
let restore_cmd_def = CliCommand::new(&API_METHOD_RESTORE)
|
||||
.arg_param(&["snapshot", "archive-name", "target"])
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_group_or_snapshot)
|
||||
.completion_cb("archive-name", complete_archive_name)
|
||||
.completion_cb("target", complete_file_name);
|
||||
|
||||
let prune_cmd_def = CliCommand::new(&API_METHOD_PRUNE)
|
||||
.arg_param(&["group"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("group", complete_backup_group)
|
||||
.completion_cb("repository", complete_repository);
|
||||
|
||||
|
@ -1669,6 +1672,7 @@ fn main() {
|
|||
|
||||
let change_owner_cmd_def = CliCommand::new(&API_METHOD_CHANGE_BACKUP_OWNER)
|
||||
.arg_param(&["group", "new-owner"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("group", complete_backup_group)
|
||||
.completion_cb("new-owner", complete_auth_id)
|
||||
.completion_cb("repository", complete_repository);
|
||||
|
|
|
@ -29,9 +29,10 @@ use pbs_tools::crypt_config::CryptConfig;
|
|||
use pbs_tools::json::required_string_param;
|
||||
|
||||
use crate::{
|
||||
complete_group_or_snapshot, complete_img_archive_name, complete_pxar_archive_name,
|
||||
complete_repository, connect, dir_or_last_from_group, extract_repository_from_value,
|
||||
optional_ns_param, record_repository, BufferedDynamicReadAt, REPO_URL_SCHEMA,
|
||||
complete_group_or_snapshot, complete_img_archive_name, complete_namespace,
|
||||
complete_pxar_archive_name, complete_repository, connect, dir_or_last_from_group,
|
||||
extract_repository_from_value, optional_ns_param, record_repository, BufferedDynamicReadAt,
|
||||
REPO_URL_SCHEMA,
|
||||
};
|
||||
|
||||
#[sortable]
|
||||
|
@ -129,6 +130,7 @@ pub fn mount_cmd_def() -> CliCommand {
|
|||
CliCommand::new(&API_METHOD_MOUNT)
|
||||
.arg_param(&["snapshot", "archive-name", "target"])
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_group_or_snapshot)
|
||||
.completion_cb("archive-name", complete_pxar_archive_name)
|
||||
.completion_cb("target", complete_file_name)
|
||||
|
@ -138,6 +140,7 @@ pub fn map_cmd_def() -> CliCommand {
|
|||
CliCommand::new(&API_METHOD_MAP)
|
||||
.arg_param(&["snapshot", "archive-name"])
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_group_or_snapshot)
|
||||
.completion_cb("archive-name", complete_img_archive_name)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,10 @@ use proxmox_router::cli::{
|
|||
};
|
||||
use proxmox_schema::api;
|
||||
|
||||
use crate::{connect, extract_repository_from_value, optional_ns_param, record_repository};
|
||||
use crate::{
|
||||
complete_namespace, connect, extract_repository_from_value, optional_ns_param,
|
||||
record_repository,
|
||||
};
|
||||
|
||||
#[api(
|
||||
input: {
|
||||
|
@ -157,14 +160,20 @@ pub fn cli_map() -> CliCommandMap {
|
|||
CliCommandMap::new()
|
||||
.insert(
|
||||
"list",
|
||||
CliCommand::new(&API_METHOD_LIST_NAMESPACES).arg_param(&["ns"]),
|
||||
CliCommand::new(&API_METHOD_LIST_NAMESPACES)
|
||||
.arg_param(&["ns"])
|
||||
.completion_cb("ns", complete_namespace),
|
||||
)
|
||||
.insert(
|
||||
"create",
|
||||
CliCommand::new(&API_METHOD_CREATE_NAMESPACE).arg_param(&["ns"]),
|
||||
CliCommand::new(&API_METHOD_CREATE_NAMESPACE)
|
||||
.arg_param(&["ns"])
|
||||
.completion_cb("ns", complete_namespace),
|
||||
)
|
||||
.insert(
|
||||
"delete",
|
||||
CliCommand::new(&API_METHOD_DELETE_NAMESPACE).arg_param(&["ns"]),
|
||||
CliCommand::new(&API_METHOD_DELETE_NAMESPACE)
|
||||
.arg_param(&["ns"])
|
||||
.completion_cb("ns", complete_namespace),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ use pbs_tools::json::required_string_param;
|
|||
|
||||
use crate::{
|
||||
api_datastore_list_snapshots, complete_backup_group, complete_backup_snapshot,
|
||||
complete_repository, connect, crypto_parameters, extract_repository_from_value,
|
||||
optional_ns_param, record_repository, BackupDir, KEYFD_SCHEMA, KEYFILE_SCHEMA, REPO_URL_SCHEMA,
|
||||
complete_namespace, complete_repository, connect, crypto_parameters,
|
||||
extract_repository_from_value, optional_ns_param, record_repository, BackupDir, KEYFD_SCHEMA,
|
||||
KEYFILE_SCHEMA, REPO_URL_SCHEMA,
|
||||
};
|
||||
|
||||
fn snapshot_args(ns: &BackupNamespace, snapshot: &BackupDir) -> Result<Value, Error> {
|
||||
|
@ -480,12 +481,14 @@ fn protected_cli() -> CliCommandMap {
|
|||
"show",
|
||||
CliCommand::new(&API_METHOD_SHOW_PROTECTION)
|
||||
.arg_param(&["snapshot"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
.insert(
|
||||
"update",
|
||||
CliCommand::new(&API_METHOD_UPDATE_PROTECTION)
|
||||
.arg_param(&["snapshot", "protected"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
}
|
||||
|
@ -496,12 +499,14 @@ fn notes_cli() -> CliCommandMap {
|
|||
"show",
|
||||
CliCommand::new(&API_METHOD_SHOW_NOTES)
|
||||
.arg_param(&["snapshot"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
.insert(
|
||||
"update",
|
||||
CliCommand::new(&API_METHOD_UPDATE_NOTES)
|
||||
.arg_param(&["snapshot", "notes"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
}
|
||||
|
@ -514,6 +519,7 @@ pub fn snapshot_mgtm_cli() -> CliCommandMap {
|
|||
"list",
|
||||
CliCommand::new(&API_METHOD_LIST_SNAPSHOTS)
|
||||
.arg_param(&["group"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("group", complete_backup_group)
|
||||
.completion_cb("repository", complete_repository),
|
||||
)
|
||||
|
@ -521,6 +527,7 @@ pub fn snapshot_mgtm_cli() -> CliCommandMap {
|
|||
"files",
|
||||
CliCommand::new(&API_METHOD_LIST_SNAPSHOT_FILES)
|
||||
.arg_param(&["snapshot"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
|
@ -528,6 +535,7 @@ pub fn snapshot_mgtm_cli() -> CliCommandMap {
|
|||
"forget",
|
||||
CliCommand::new(&API_METHOD_FORGET_SNAPSHOTS)
|
||||
.arg_param(&["snapshot"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("repository", complete_repository)
|
||||
.completion_cb("snapshot", complete_backup_snapshot),
|
||||
)
|
||||
|
@ -535,6 +543,7 @@ pub fn snapshot_mgtm_cli() -> CliCommandMap {
|
|||
"upload-log",
|
||||
CliCommand::new(&API_METHOD_UPLOAD_LOG)
|
||||
.arg_param(&["snapshot", "logfile"])
|
||||
.completion_cb("ns", complete_namespace)
|
||||
.completion_cb("snapshot", complete_backup_snapshot)
|
||||
.completion_cb("logfile", complete_file_name)
|
||||
.completion_cb("keyfile", complete_file_name)
|
||||
|
|
Loading…
Reference in New Issue