norgbackup/norg/restic/restic.nim

35 lines
854 B
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 extract
2024-08-23 11:30:36 +02:00
import prune
proc execute*(nc: NorgConfig, repo: Repository) =
case nc.args.command
of INIT:
discard initRepo(nc, repo)
of CREATE:
run_actions(norg_config.actions.before_backup)
discard createBackup(nc, repo)
run_actions(norg_config.actions.after_backup)
of LIST:
2024-08-23 11:30:36 +02:00
discard listSnapshots(nc, repo)
of MOUNT:
2024-08-23 11:30:36 +02:00
discard mountSnapshot(nc, repo)
of UMOUNT:
2024-08-23 11:30:36 +02:00
discard unmountSnapshot(nc)
of EXTRACT:
run_actions(norg_config.actions.before_extract)
discard extractArchive(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)
discard pruneRepo(nc, repo)
run_actions(norg_config.actions.after_prune)
else:
discard