-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add support for a Java like parser mode #7
Comments
Thanks for the suggestion. Any ideas on how option names would be specified? Right now you include the dashes, like: val verbose by parser.flagging("-v", "--verbose", Would the client instead have to say "-verbose", or would or would "--verbose" be transformed into "-verbose"? Also, right now it's also possible (though arguably inadvisable) to have single letter "long" options: val short_a by parser.flagging("-a", ...
val long_a by parser.flagging("--a", ... I'm thinking this would be an error in a Java flag mode. I'm not entirely clear on how option arguments are handled with Java-style options. Looking at the options of One thing I'm not sure how to resolve is that Java style options seem to let the option decide whether the first of its arguments must be in the same argument, as in Playing around with this actually made me realize that there's a small bug with the existing parsing in that you cannot create an option that non-greedily takes an optional argument, like the |
I'd vote for
or if you don't need/want the short form simply
Main difference would be to always go into the first if branch here if Java mode is active and only one dash is there: https://github.com/xenomachina/kotlin-argparser/blob/master/src/main/kotlin/ArgParser.kt#L434
I'd keep it simple for now. Java isn't necessarily super consistent here. I'd personally only need this:
no weird colons and so on. |
It would be nice to have a parser mode which parses all arguments as long arguments regardless of the amount of dashes, so you could have a parser that parses like typical java applications (for example consider
java -version
).The text was updated successfully, but these errors were encountered: