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

Use an arg parsing library for main and subcommands #71

Closed
5 tasks
mattlqx opened this issue Feb 4, 2021 · 2 comments · Fixed by #73
Closed
5 tasks

Use an arg parsing library for main and subcommands #71

mattlqx opened this issue Feb 4, 2021 · 2 comments · Fixed by #73
Labels
enhancement New feature or request

Comments

@mattlqx
Copy link
Collaborator

mattlqx commented Feb 4, 2021

There's a ton of community packages out there for handling cli arguments. There's presently the following issues in handling args in vsh:

  • subcommands only recognize flags at the end of a command
  • flags can't be combined in current implementation (-abc)
  • main arg splitting is custom implementation
  • args that accept values aren't implemented
  • help strings are created by hand as opposed to coming from structure

For all these reasons, a good community library should be leveraged. https://github.com/avelino/awesome-go#command-line has a dizzying list of what's available.

@mattlqx
Copy link
Collaborator Author

mattlqx commented Feb 4, 2021

I personally think https://github.com/alexflint/go-arg is the way to go here. Args are defined in a struct and supports subcommands which gels nicely with how they're implemented today.

@fishi0x01
Copy link
Owner

Good point - thank you! 👍
The amount of flags has been growing quite a bit. So an arg-parse library definitely makes sense.

I see you also already implemented this. Will have a look at your PR today.

@fishi0x01 fishi0x01 added the enhancement New feature or request label Feb 5, 2021
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

Successfully merging a pull request may close this issue.

2 participants