-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The parsing functionality provided by the command and types packages currently has several major limitations that should be addressed:
- Repeated flags (ex.
-vvvfor verbosity level) are not supported, and are currently collapsed into one. - Flags that are not at the beginning of the command are treated as generic arguments.
- Flags without values are represented as
BoolValue{ V: true }, which is indistinguishable from a flag with an explicit boolean value. This causes trouble for converting the flags back to arguments when calling or serializing a command. - If
parseOptions.assumeOptionArgumentsistrue, a flag with no value can steal the first positional argument. Since flags are not stored in any particular order, this makes it possible that the argument will become mixed in with other flags instead of being placed back in its old position. -
--flag=valueis not supported. - A
command.Commandcurrently cannot be serialized back into a string equivalent to the one it was parsed from, for many of the reasons listed above. This is worked around withcommand.Command.Original, but this is fragile and assigned in odd places at different levels of the system. - Command equality testing is currently not implemented.
-
command.Commandanddata.CommandEntryhave a cyclical dependency, where aCommandis needed to get eCommandEntryfrom the data access layer, but theCommandEntrythen contains parse options that are used to re-parse theCommand.
It would probably be advantageous to come up with design changes or a redesign that hits all of these at once.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request