catalog: shell: Introduce clear-selected command.

'clear-selected' allows to clear all the match patterns from the list of
patterns for a subsequent restore.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2020-02-27 14:33:33 +01:00 committed by Dietmar Maurer
parent 8e464141cf
commit 35ddf0b419

View File

@ -64,6 +64,10 @@ pub fn catalog_shell_cli() -> CommandLineInterface {
.arg_param(&["path"])
.completion_cb("path", Shell::complete_path)
)
.insert(
"clear-selected",
CliCommand::new(&API_METHOD_CLEAR_SELECTED_COMMAND)
)
.insert(
"restore-selected",
CliCommand::new(&API_METHOD_RESTORE_SELECTED_COMMAND)
@ -466,6 +470,15 @@ fn deselect_command(path: String) -> Result<(), Error> {
})
}
#[api( input: { properties: { } })]
/// Clear the list of files selected for restore.
fn clear_selected_command() -> Result<(), Error> {
Context::with(|ctx| {
ctx.selected.clear();
Ok(())
})
}
#[api(
input: {
properties: {