Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
If an argument is missing, it's value is "nil" (a string), not nil (the real nil). #22
Consider the following simple example:
import docopt const doc = """ Foo. Usage: doco do [--param=<some-param>] doco (-h | --help) doco --version Options: -h --help Show this screen. -v --version Show version. -p --param=<some-param> Some param without default value. """ let args = docopt(doc, version = "0.1.0") if args["do"]: let param = $args["--param"] # expected to be nil if not passed echo param.isNil echo param == "nil"
Compile and run it:
As you can see, if
@BlaXpirit Still, it's a bit weird that $ applied to
I'm asking for two reasons:
Here's another example of what looks like a problem. The following script:
Compiles without errors on Nim 0.16.0 (Ubuntu 16.04, x86_64).
When the compiled program is run with no arguments:
When run with an argument:
When run with the argument
So how do we test for
You could sort this out by providing a