aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreuxane2024-11-30 10:03:41 +0100
committereuxane2024-11-30 10:03:41 +0100
commit12845f449cff81c37c646ecf0c6b7269de71f190 (patch)
tree2b16619ecdf409d2f171f9dc7b58e2b16ea721a1
parent903306030f59554ff6fd73146fd30c2330504358 (diff)
downloadtickwatch-12845f449cff81c37c646ecf0c6b7269de71f190.tar.gz
cli: reject invalid option choices
-rw-r--r--main.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.nim b/main.nim
index cca5528..115808d 100644
--- a/main.nim
+++ b/main.nim
@@ -61,17 +61,20 @@ proc main() =
61 of "log10": scale = log10 61 of "log10": scale = log10
62 of "ln": scale = ln 62 of "ln": scale = ln
63 of "linear", "lin": scale = (val: float) => val 63 of "linear", "lin": scale = (val: float) => val
64 else: raise newException(ValueError, "Unrecognised scale choice")
64 65
65 of "symbols": 66 of "symbols":
66 case val: 67 case val:
67 of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS 68 of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS
68 of "numeric", "ascii": symbols = NUMERIC_SYMBOLS 69 of "numeric", "ascii": symbols = NUMERIC_SYMBOLS
70 else: raise newException(ValueError, "Unrecognised symbols choice")
69 71
70 of "timestamp": 72 of "timestamp":
71 case val: 73 case val:
72 of "datetime", "date-time": timestampHeader = formatTimestampDateTime 74 of "datetime", "date-time": timestampHeader = formatTimestampDateTime
73 of "unix", "epoch": timestampHeader = formatTimestampUnix 75 of "unix", "epoch": timestampHeader = formatTimestampUnix
74 of "none", "false": timestampHeader = formatTimestampNone 76 of "none", "false": timestampHeader = formatTimestampNone
77 else: raise newException(ValueError, "Unrecognised timestamp choice")
75 78
76 of "range": 79 of "range":
77 let parts = val.split(':', 1) 80 let parts = val.split(':', 1)