diff --git a/norg/borg/prune.nim b/norg/borg/prune.nim index 0bcafc5..9f1b72e 100644 --- a/norg/borg/prune.nim +++ b/norg/borg/prune.nim @@ -1,6 +1,10 @@ +import strformat import ../model/config_type import execute + +proc addPruneOptions*(cmd: var string, maintenance: Maintenance) = + cmd = fmt"""{cmd} --keep-hourly {maintenance.keep_hourly} --keep-daily {maintenance.keep_daily} --keep-weekly {maintenance.keep_weekly} --keep-monthly {maintenance.keep_monthly} --keep-yearly {maintenance.keep_yearly} """ proc pruneRepo*(nc: NorgConfig, repo: Repository): int = var cmd = genCommand(cmd = "prune", repo = repo.path, further_args = nc.args.further_args) diff --git a/norg/restic/execute.nim b/norg/restic/execute.nim index f97d9ef..4971e28 100644 --- a/norg/restic/execute.nim +++ b/norg/restic/execute.nim @@ -31,12 +31,5 @@ proc genForgetCommand*(repo: string, archive: string, further_args: seq[string]) proc genPruneCommand*(repo: string, further_args: seq[string], maintenance: Maintenance): string = let args = further_args.join(" ") - let cmd = fmt"""{RESTIC_BIN} forget --prune \ - --keep-hourly {maintenance.keep_hourly} \ - --keep-daily {maintenance.keep_daily} \ - --keep-weekly {maintenance.keep_weekly} \ - --keep-monthly {maintenance.keep_monthly} \ - --keep-yearly {maintenance.keep_yearly} \ - -r {repo} {args} - """ + let cmd = fmt"""{RESTIC_BIN} forget --prune --keep-hourly {maintenance.keep_hourly} --keep-daily {maintenance.keep_daily} --keep-weekly {maintenance.keep_weekly} --keep-monthly {maintenance.keep_monthly} --keep-yearly {maintenance.keep_yearly} -r {repo} {args}""" return cmd diff --git a/norg/utils/run.nim b/norg/utils/run.nim index 3c0b253..11b0c39 100644 --- a/norg/utils/run.nim +++ b/norg/utils/run.nim @@ -21,11 +21,3 @@ proc runDiscard*(cmd: string): int = echo getCurrentExceptionMsg() return 1 -proc addPruneOptions*(cmd: var string, maintenance: Maintenance) = - cmd = fmt"""{cmd} \ - --keep-hourly {maintenance.keep_hourly} \ - --keep-daily {maintenance.keep_daily} \ - --keep-weekly {maintenance.keep_weekly} \ - --keep-monthly {maintenance.keep_monthly} \ - --keep-yearly {maintenance.keep_yearly} \ - """