norgbackup/norg/borg/exit_codes.nim

16 lines
240 B
Nim
Raw Normal View History

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