Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command parsing limitations #225

Open
8 tasks
grebneerg opened this issue Jul 13, 2022 · 0 comments
Open
8 tasks

Command parsing limitations #225

grebneerg opened this issue Jul 13, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@grebneerg
Copy link
Member

grebneerg commented Jul 13, 2022

The parsing functionality provided by the command and types packages currently has several major limitations that should be addressed:

  • Repeated flags (ex. -vvv for 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.assumeOptionArguments is true, 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=value is not supported.
  • A command.Command currently 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 with command.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.Command and data.CommandEntry have a cyclical dependency, where a Command is needed to get e CommandEntry from the data access layer, but the CommandEntry then contains parse options that are used to re-parse the Command.

It would probably be advantageous to come up with design changes or a redesign that hits all of these at once.

@grebneerg grebneerg added the enhancement New feature or request label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant