some command line fixes
This commit is contained in:
parent
708f452e9b
commit
874b4362c8
3 changed files with 5 additions and 16 deletions
|
@ -1,7 +1,11 @@
|
|||
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)
|
||||
cmd.addPruneOptions(nc.maintenance)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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} \
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue