Open
Description
The result of the docopt call seems a bit unwieldy to use. What about a macro to unpack the table into pretty and readly usable variables, kinda like commandeer?
unpack args:
variable_name, type, "table-key"
It would be good if the table key can optionally be omitted if the variable name unambiguously refer to one of the table keys. From the front page example:
import docopt
let args = docopt(doc, version = "Naval Fate 2.0")
unpack args:
name, seq[string], "<name>" # table-key unnecessary
x, float
y, float
speed, float, "--speed" # other unnecessary example
morred, bool
mineSet, bool, "set" # a classical case where table-key is necessary
ships[name[0]].move(x, y, speed=speed)
I think it is much better if the typing info is centralized like that, instead of scattered along the code with parseFloat()
and such.
The syntax is debatable. And it might be better to make an alternative docopt call to do that directly, w/o the need to create an args table. But of course, one should retain the old way for backwards compatibility/whoever likes it.