norgbackup/norg/restic/restic.nim

30 lines
695 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
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 listArchives(nc, repo)
of MOUNT:
discard mountArchive(nc, repo)
of UMOUNT:
discard unmountArchive(nc)
of EXTRACT:
run_actions(norg_config.actions.before_extract)
discard extractArchive(nc, repo)
run_actions(norg_config.actions.after_extract)
else:
discard