3 ms·
There are lots of commandline parsing libraries available in Java. I suggest taking a look at the following ones as a learning exercise (which seems to be the a
by rickette 11y ago
There are lots of commandline parsing libraries available in Java. I suggest taking a look at the following ones as a learning exercise (which seems to be the aim of this project):
https://commons.apache.org/proper/commons-cli/ https://commons.apache.org/proper/commons-cli/ (one of the oldest and most widely used parsers, supports various styles).
https://github.com/airlift/airline https://github.com/airlift/airline (Git-style commandline parser)
- sysdevone 11y agoThanks for the feedback.
- bhaak 11y agoI would also recommend looking at JOpt Simple. https://pholser.github.io/jopt-simple/ https://pholser.github.io/jopt-simple/ JOpt Simple tries to not only to be simple in use but also in code by restricting the commandline syntax to the command line option syntaxes of POSIX getopt() and GNU getopt_long(). I like that much better than the support-them-all attitude of Commons CLI. Whoever thought that having Git-style command line options is a good idea should have their programming license revoked (although the syntax of Git's command line options is the least problem I have with them).
- sysdevone 11y agoThank you for the comment.
- stewbrew 11y agoI recently used JCommander and found it really easy to use. BTW being used to how most linux commands work, the use single dashes for long option names puts me off.
- sysdevone 11y agoThanks for the feedback. The project readme.md has been updated to show that a command does not need to have a single dash or contain any dashes. A command can start with any character as long as it is not one of the reserved !?#:
- iso-8859-1 11y agoCommons-cli is pretty much unmaintained, look in the bug tracker. It would be nice if this project could explain why it is better than Commons-cli. Though in the end only a year long maintenance effort will convince me.
- sysdevone 11y agoThank you for the feedback. The purpose of this project is to create my own implementation and share that thought. It is not an attempt to say or show that it is better than what is available.
- grkvlt 11y agoWe used Airline in Apache Brooklyn, and found it really easy to use. A lot of the jclouds team have contributed, and the code seems high quality. I know there are open PRs which are a few months old, so it obviously needs a bit of love and attention still...
- sysdevone 11y agoThanks for sharing.