diff --git a/norg/restic/execute.nim b/norg/restic/execute.nim index 10d4c0e..cdaed87 100644 --- a/norg/restic/execute.nim +++ b/norg/restic/execute.nim @@ -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 diff --git a/norg/restic/prune.nim b/norg/restic/prune.nim index a48cb1a..64cc683 100644 --- a/norg/restic/prune.nim +++ b/norg/restic/prune.nim @@ -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