Allow multiple targets for subvolume delete.

Signed-off-by: Malte Schröder <malte.schroeder@tnxip.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Malte Schröder 2024-10-25 20:52:26 +02:00 committed by Kent Overstreet
parent 2541755981
commit cb8dc1b2ba

View File

@ -24,7 +24,7 @@ enum Subcommands {
#[command(visible_aliases = ["del"])] #[command(visible_aliases = ["del"])]
Delete { Delete {
/// Path /// Path
target: PathBuf, targets: Vec<PathBuf>,
}, },
#[command(allow_missing_positional = true, visible_aliases = ["snap"])] #[command(allow_missing_positional = true, visible_aliases = ["snap"])]
@ -58,7 +58,8 @@ pub fn subvolume(argv: Vec<String>) -> Result<()> {
} }
} }
} }
Subcommands::Delete { target } => { Subcommands::Delete { targets } => {
for target in targets {
let target = target let target = target
.canonicalize() .canonicalize()
.context("subvolume path does not exist or can not be canonicalized")?; .context("subvolume path does not exist or can not be canonicalized")?;
@ -69,6 +70,7 @@ pub fn subvolume(argv: Vec<String>) -> Result<()> {
.context("Failed to delete the subvolume")?; .context("Failed to delete the subvolume")?;
} }
} }
}
Subcommands::Snapshot { Subcommands::Snapshot {
read_only, read_only,
source, source,