some command line fixes

This commit is contained in:
Paul Wilde 2024-08-27 20:36:43 +01:00
parent 708f452e9b
commit 874b4362c8
3 changed files with 5 additions and 16 deletions

View file

@ -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)

View file

@ -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

View file

@ -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} \
"""