prune: Remove standard output when using --json

This commit is contained in:
Dark Dragon 2025-02-05 22:54:25 +01:00
parent e67a805bfc
commit c77edae71f
1 changed files with 8 additions and 3 deletions

View File

@ -175,7 +175,12 @@ func runPruneWithRepo(ctx context.Context, opts PruneOptions, gopts GlobalOption
Print("warning: running prune without a cache, this may be very slow!\n")
}
printer := newTerminalProgressPrinter(gopts.verbosity, term)
var printer progress.Printer
if !gopts.JSON {
printer = newTerminalProgressPrinter(gopts.verbosity, term)
} else {
printer = &progress.NoopPrinter{}
}
printer.P("loading indexes...\n")
// loading the index before the snapshots is ok, as we use an exclusive lock here