2024-08-27 21:36:43 +02:00
|
|
|
import strformat
|
2024-08-19 03:21:46 +02:00
|
|
|
import ../model/config_type
|
|
|
|
|
|
|
|
import execute
|
2024-08-27 21:36:43 +02:00
|
|
|
|
|
|
|
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} """
|
2024-08-19 03:21:46 +02:00
|
|
|
|
|
|
|
proc pruneRepo*(nc: NorgConfig, repo: Repository): int =
|
2024-08-23 13:04:27 +02:00
|
|
|
var cmd = genCommand(cmd = "prune", repo = repo.path, further_args = nc.args.further_args)
|
2024-08-19 03:21:46 +02:00
|
|
|
cmd.addPruneOptions(nc.maintenance)
|
|
|
|
return run cmd
|
2024-08-23 15:08:14 +02:00
|
|
|
|
|
|
|
proc deleteArchive*(nc: NorgConfig, repo: Repository): int =
|
2024-08-27 20:27:36 +02:00
|
|
|
var cmd = genDeleteCommand(repo = repo.path, archive = nc.args.archive, further_args = nc.args.further_args)
|
2024-08-23 15:08:14 +02:00
|
|
|
return run cmd
|