Negative Numbers As Arguments #241
-
Hi, I want to be able to receive positive and negative numbers as positional arguments, however it seems that cligen treats negative numbers as options: # main.nim
proc brightness(restore = false, values: seq[string]) =
echo values
dipatch brightness
I also tried |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes. If you don't need to intermingle options and positional arguments on command-lines then you can just use a |
Beta Was this translation helpful? Give feedback.
Yes. If you don't need to intermingle options and positional arguments on command-lines then you can just use a
--
separator between options and arguments, e.g.,sum -ab -cx -dy -- -1 -2 -3
. If you do need to intermingle (much more rare) then you can prefix the-
sign with a space as insum -ab \ -1 -cx \ -2 -dy \ -3
. You could also use quotes instead of escaping that space, of course, as insum -ab " -1" -cx " -2" -dy " -3"
.