Skip to content

Commit 5b130ca

Browse files
committed
feat(commands): Add json option to prune
1 parent 7abe9ec commit 5b130ca

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

Cargo.lock

Lines changed: 34 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"]
4040

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

4646
# allocators
4747
jemallocator-global = { version = "0.3.2", optional = true }

src/commands/prune.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ impl PruneCmd {
3535

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

38-
print_stats(&pruner.stats);
38+
if config.global.json {
39+
let mut stdout = std::io::stdout();
40+
let debug: Vec<_> = pruner.stats.debug.0.iter().collect();
41+
serde_json::to_writer_pretty(&mut stdout, &debug)?;
42+
} else {
43+
print_stats(&pruner.stats);
44+
}
3945

4046
if config.global.dry_run {
4147
repo.warm_up(pruner.repack_packs().into_iter())?;

0 commit comments

Comments
 (0)