Merge pull request #872 from middelink/fix-787

Suppress (non error) output of `forget` during -q
This commit is contained in:
Alexander Neumann 2017-03-09 21:23:36 +01:00
commit deddedd88f

View file

@ -142,19 +142,19 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
return err
}
if opts.GroupByTags {
Printf("snapshots for host %v, tags [%v], paths: [%v]:\n\n", key.Hostname, strings.Join(key.Tags, ", "), strings.Join(key.Paths, ", "))
Verbosef("snapshots for host %v, tags [%v], paths: [%v]:\n\n", key.Hostname, strings.Join(key.Tags, ", "), strings.Join(key.Paths, ", "))
} else {
Printf("snapshots for host %v, paths: [%v]:\n\n", key.Hostname, strings.Join(key.Paths, ", "))
Verbosef("snapshots for host %v, paths: [%v]:\n\n", key.Hostname, strings.Join(key.Paths, ", "))
}
keep, remove := restic.ApplyPolicy(snapshotGroup, policy)
if len(keep) != 0 {
if len(keep) != 0 && !gopts.Quiet {
Printf("keep %d snapshots:\n", len(keep))
PrintSnapshots(globalOptions.stdout, keep)
Printf("\n")
}
if len(remove) != 0 {
if len(remove) != 0 && !gopts.Quiet {
Printf("remove %d snapshots:\n", len(remove))
PrintSnapshots(globalOptions.stdout, remove)
Printf("\n")
@ -174,7 +174,7 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
}
if removeSnapshots > 0 && opts.Prune {
Printf("%d snapshots have been removed, running prune\n", removeSnapshots)
Verbosef("%d snapshots have been removed, running prune\n", removeSnapshots)
if !opts.DryRun {
return pruneRepository(gopts, repo)
}