aboutsummaryrefslogtreecommitdiff
path: root/main.nim
diff options
context:
space:
mode:
Diffstat (limited to 'main.nim')
-rw-r--r--main.nim13
1 files changed, 12 insertions, 1 deletions
diff --git a/main.nim b/main.nim
index 3128bac..cca5528 100644
--- a/main.nim
+++ b/main.nim
@@ -37,6 +37,7 @@ proc main() =
37 var 37 var
38 scale: Scale = log2 38 scale: Scale = log2
39 symbols = UNICODE_SYMBOLS 39 symbols = UNICODE_SYMBOLS
40 timestampHeader = formatTimestampDateTime
40 (min, max) = (0, 1000) 41 (min, max) = (0, 1000)
41 probe: (timeout: Duration) -> int 42 probe: (timeout: Duration) -> int
42 43
@@ -66,6 +67,12 @@ proc main() =
66 of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS 67 of "unicode", "utf8", "utf-8": symbols = UNICODE_SYMBOLS
67 of "numeric", "ascii": symbols = NUMERIC_SYMBOLS 68 of "numeric", "ascii": symbols = NUMERIC_SYMBOLS
68 69
70 of "timestamp":
71 case val:
72 of "datetime", "date-time": timestampHeader = formatTimestampDateTime
73 of "unix", "epoch": timestampHeader = formatTimestampUnix
74 of "none", "false": timestampHeader = formatTimestampNone
75
69 of "range": 76 of "range":
70 let parts = val.split(':', 1) 77 let parts = val.split(':', 1)
71 if parts.len != 2: raise newException(ValueError, "Invalid range") 78 if parts.len != 2: raise newException(ValueError, "Invalid range")
@@ -87,7 +94,11 @@ proc main() =
87 if probe == nil: 94 if probe == nil:
88 raise newException(ValueError, "Missing monitor argument") 95 raise newException(ValueError, "Missing monitor argument")
89 96
90 loop(probe, (val: int) => symbols.indicator(min, max, val, scale)) 97 loop(
98 probe,
99 (val: int) => symbols.indicator(min, max, val, scale),
100 timestampHeader,
101 )
91 102
92 103
93when not defined(test): 104when not defined(test):