use clap::{ArgAction, Command, ValueHint, arg};
use super::output_flag_long_only;
pub(super) fn add_vcluster_restore_args(cmd: Command) -> Command {
cmd
.arg_required_else_help(true)
.arg(
arg!(-b --"bos-file" <FILE> "Session template backup file")
.value_hint(ValueHint::FilePath),
)
.arg(
arg!(-c --"cfs-file" <FILE> "Configuration backup file")
.value_hint(ValueHint::FilePath),
)
.arg(
arg!(-j --"hsm-file" <FILE> "Group description backup file")
.value_hint(ValueHint::FilePath),
)
.arg(
arg!(-m --"ims-file" <FILE> "Image metadata backup file")
.value_hint(ValueHint::FilePath),
)
.arg(
arg!(-i --"image-dir" <PATH> "Directory containing the image files")
.value_hint(ValueHint::DirPath),
)
.arg(arg!(-p --"pre-hook" <SCRIPT> "Command to run before the restore.\neg: --pre-hook \"echo hello\""))
.arg(
arg!(-a --"post-hook" <SCRIPT> "Command to run after a successful restore.\neg: --post-hook \"echo hello\""),
)
.arg(arg!(-o --"overwrite" "Overwrite existing data").action(ArgAction::SetTrue))
.arg(output_flag_long_only())
}
pub fn subcommand_restore() -> Command {
Command::new("restore")
.arg_required_else_help(true)
.about("Restore a virtual cluster from a backup bundle")
.subcommand(
add_vcluster_restore_args(Command::new("vcluster"))
.about("Restore a virtual cluster from a backup bundle"),
)
}
pub(super) fn subcommand_migrate_restore() -> Command {
add_vcluster_restore_args(Command::new("restore")).about(
"[DEPRECATED] Use 'manta restore vcluster' instead. \
The old path keeps working for one release.",
)
}