Closed ffunenga closed 8 years ago
Good question. We had a quite long discussion with @halst about this and I think we came into conclusion that let's just map all arguments to plain words. For example, <y>
will become y
. Special arguments could be double underscored, like __help
, __usage
.
Yeah, just keep it simple in the beginning. Maybe in the end we'll have some templates that will produce arguments.options.help
and arguments.commands.help
kind of structs.
Currently we've got the Naval Fate example being converted from this:
to this:
How do we translate CLI syntax into C valid struct elements?
--help
becomesDocoptArgs.help
, what happens to<y>
?help
(related with the application context) and there is the generic--help
(related with the CLI context). Is this possible? How do we solve it?Valid variable names in C respect the following three rules:
[EDIT1] Is this (a bad idea | ugly | not universal C)?
leafname = ''.join(('_' if c in '<>-' else c) for c in leaf.name)
originating in:
In my PC, it compiles and executes.
[EDIT2] Possible conflict: an argument called
__remove
and an option named--remove
wich will become__remove
. Its crazy/strange to have an argument named__remove
.Maybe Arguments not starting in letters should be prohibited upstream. @docopt/docopt @halst Or maybe only docopt_c.py should prohibit it.