mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
Add tags to forget command
This commit is contained in:
parent
673bce936e
commit
0f9fb37c78
1 changed files with 6 additions and 1 deletions
|
@ -16,7 +16,8 @@ type CmdForget struct {
|
||||||
Monthly int `short:"m" long:"keep-monthly" description:"keep the last n monthly snapshots"`
|
Monthly int `short:"m" long:"keep-monthly" description:"keep the last n monthly snapshots"`
|
||||||
Yearly int `short:"y" long:"keep-yearly" description:"keep the last n yearly snapshots"`
|
Yearly int `short:"y" long:"keep-yearly" description:"keep the last n yearly snapshots"`
|
||||||
|
|
||||||
Hostname string `long:"hostname" description:"only forget snapshots for the given hostname"`
|
Hostname string `long:"hostname" description:"only forget snapshots for the given hostname"`
|
||||||
|
Tags []string `long:"tag" description:"only forget snapshots with the tag (can be specified multiple times)"`
|
||||||
|
|
||||||
DryRun bool `short:"n" long:"dry-run" description:"do not delete anything, just print what would be done"`
|
DryRun bool `short:"n" long:"dry-run" description:"do not delete anything, just print what would be done"`
|
||||||
|
|
||||||
|
@ -135,6 +136,10 @@ func (cmd CmdForget) Execute(args []string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !sn.HasTags(cmd.Tags) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
k := key{Hostname: sn.Hostname, Dirs: strings.Join(sn.Paths, ":")}
|
k := key{Hostname: sn.Hostname, Dirs: strings.Join(sn.Paths, ":")}
|
||||||
list := snapshotGroups[k]
|
list := snapshotGroups[k]
|
||||||
list = append(list, sn)
|
list = append(list, sn)
|
||||||
|
|
Loading…
Reference in a new issue