diff --git a/norg/borg/create.nim b/norg/borg/create.nim index c778133..33a3c6a 100644 --- a/norg/borg/create.nim +++ b/norg/borg/create.nim @@ -1,10 +1,9 @@ import ../model/config_type import ../model/state_type -import ../model/exit_codes -import ../model/tool_type import ../notifier/notifier import ../model/log_type +import exit_codes import execute import prune @@ -28,7 +27,7 @@ proc createArchive(nc: NorgConfig, repo: Repository, archivename: string, retry: return (BORG_ERROR, "Max Retries Reached") else: return createArchive(nc, repo, archivename, retry + 1) - return (res.toExitCode(BORG),"Success") + return (res.toExitCode(),"Success") proc createBackup*(nc: NorgConfig, repo: Repository): EXIT_CODE = let start_time = now() diff --git a/norg/borg/exit_codes.nim b/norg/borg/exit_codes.nim new file mode 100644 index 0000000..71f1214 --- /dev/null +++ b/norg/borg/exit_codes.nim @@ -0,0 +1,15 @@ + + +import std/enumutils + +type + EXIT_CODE* = enum + BORG_SUCCESS = 0 + BORG_WARNING = 1 + BORG_ERROR = 2 + OTHER = 99 + +proc toExitCode*(i: int): EXIT_CODE = + for code in EXIT_CODE: + if i == ord(code): return code + return OTHER diff --git a/norg/model/exit_codes.nim b/norg/model/exit_codes.nim index 2167102..e69de29 100644 --- a/norg/model/exit_codes.nim +++ b/norg/model/exit_codes.nim @@ -1,15 +0,0 @@ -import tool_type - -import std/enumutils - -type - EXIT_CODE* = enum - BORG_SUCCESS = 0 - BORG_WARNING = 1 - BORG_ERROR = 2 - OTHER = 99 - -proc toExitCode*(i: int, tool: BackupTool): EXIT_CODE = - for code in EXIT_CODE: - if i == ord(code): return code - return OTHER