norgbackup/norg/restic/restic.nim

34 lines
854 B
Nim

import ../model/config_type
import ../utils/actions
import init
import backup
import list
import mount
import extract
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:
discard listSnapshots(nc, repo)
of MOUNT:
discard mountSnapshot(nc, repo)
of UMOUNT:
discard unmountSnapshot(nc)
of EXTRACT:
run_actions(norg_config.actions.before_extract)
discard extractArchive(nc, repo)
run_actions(norg_config.actions.after_extract)
of PRUNE:
run_actions(norg_config.actions.before_prune)
discard pruneRepo(nc, repo)
run_actions(norg_config.actions.after_prune)
else:
discard