norgbackup/norg/restic/restic.nim

39 lines
1 KiB
Nim
Raw Normal View History

import ../model/config_type
import ../utils/actions
2024-08-23 11:12:00 +02:00
import init
import backup
import list
import mount
import restore
2024-08-23 11:30:36 +02:00
import prune
proc execute*(nc: NorgConfig, repo: Repository) =
case nc.args.command
of INIT:
echo "Initializing repo: ", repo.label
discard initRepo(nc, repo)
of CREATE:
run_actions(norg_config.actions.before_backup)
echo "Backing up to ", repo.label
discard createBackup(nc, repo)
run_actions(norg_config.actions.after_backup)
of LIST:
echo "Listing Snapshots at ", repo.label
2024-08-23 11:30:36 +02:00
discard listSnapshots(nc, repo)
of MOUNT:
echo "Mounting Snapshot from ", repo.label
2024-08-23 11:30:36 +02:00
discard mountSnapshot(nc, repo)
of EXTRACT:
run_actions(norg_config.actions.before_extract)
echo "Restoring snapshot from ", repo.label
discard restoreSnapshot(nc, repo)
run_actions(norg_config.actions.after_extract)
2024-08-23 11:30:36 +02:00
of PRUNE:
run_actions(norg_config.actions.before_prune)
echo "Pruning repo: ", repo.label
2024-08-23 11:30:36 +02:00
discard pruneRepo(nc, repo)
run_actions(norg_config.actions.after_prune)
else:
discard