added restic prune

This commit is contained in:
Paul Wilde 2024-08-23 14:12:59 +01:00
parent eaa47c9356
commit 9ea589a848
2 changed files with 9 additions and 1 deletions

View file

@ -15,3 +15,7 @@ proc genRestoreCommand*(cmd: string, repo_snapshot: string, destination: string,
let cmd = fmt"{RESTIC_BIN} {cmd} -r {repo_snapshot} --target {destination} {args}"
return cmd
proc genForgetCommand*(cmd: string, repo: string, archive: string, further_args: seq[string]): string =
let args = further_args.join(" ")
let cmd = fmt"{RESTIC_BIN} {cmd} -r {repo} {archive} {args}"
return cmd

View file

@ -14,6 +14,10 @@ proc addPruneOptions(cmd: var string, maintenance: Maintenance) =
"""
proc pruneRepo*(nc: NorgConfig, repo: Repository): int =
var cmd = genCommand(cmd = "prune", repo = repo.path, further_args = nc.args.further_args)
var cmd = genCommand(cmd = "forget --prune", repo = repo.path, further_args = nc.args.further_args)
cmd.addPruneOptions(nc.maintenance)
return run cmd
proc forgetSnapshot*(nc: NorgConfig, repo: Repository): int =
var cmd = genForgetCommand(cmd = "forget", repo = repo.path, archive = nc.args.archive, further_args = nc.args.further_args)
return run cmd