Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
feat: print out how many snapshots were deleted on success (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetkov authored Oct 9, 2023
1 parent c43084f commit dea346e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fn main() -> anyhow::Result<()> {
Ok(c.stdout)
})?;

let mut num_deleted = 0usize;
for snapshot in snapshot::to_delete(args.verbose, &config, &zfs_list_output) {
let _ = Command::new("zfs")
.args(
Expand All @@ -74,7 +75,10 @@ fn main() -> anyhow::Result<()> {
.spawn()
.context("failed to run `zfs destroy`")?
.wait();

num_deleted += 1;
}

eprintln!("deleted {num_deleted} snapshots");
Ok(())
}

0 comments on commit dea346e

Please sign in to comment.