Skip to content

Commit

Permalink
feat(commands): Add json option to prune
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Mar 4, 2024
1 parent 7abe9ec commit 5b130ca
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
49 changes: 34 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"]

[dependencies]
abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] }
rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", features = ["cli"] }
rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", features = ["cli"] }
rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", branch = "enumset", features = ["cli"] }
rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", branch = "enumset", features = ["cli"] }

# allocators
jemallocator-global = { version = "0.3.2", optional = true }
Expand Down
8 changes: 7 additions & 1 deletion src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ impl PruneCmd {

let pruner = repo.prune_plan(&self.opts)?;

print_stats(&pruner.stats);
if config.global.json {
let mut stdout = std::io::stdout();
let debug: Vec<_> = pruner.stats.debug.0.iter().collect();
serde_json::to_writer_pretty(&mut stdout, &debug)?;
} else {
print_stats(&pruner.stats);
}

if config.global.dry_run {
repo.warm_up(pruner.repack_packs().into_iter())?;
Expand Down

0 comments on commit 5b130ca

Please sign in to comment.