Skip to content

Commit 0710c57

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

File tree

4 files changed

+44
-19
lines changed

4 files changed

+44
-19
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 }

config/full.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ log-file = "/path/to/rustic.log" # Default: not set
1414
no-progress = false
1515
progress-interval = "100ms"
1616
dry-run = false
17+
json = false
1718

1819
# Global env variables: These are set by rustic before calling a subcommand, e.g. rclone or commands
1920
# defined in the repository options.
@@ -99,7 +100,6 @@ exclude-if-present = [".nobackup", "CACHEDIR.TAG"] # Default: not set
99100
custom-ignorefile = [".rusticignore", ".backupignore"] # Default: not set
100101
one-file-system = false
101102
exclude-larger-than = "100MB" # Default: not set
102-
json = false
103103
init = false
104104
no-scan = false
105105
quiet = false

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)