https://kotlinlang.org logo
#announcements
Title
# announcements
g

groostav

04/17/2017, 3:45 AM
Hey gents, I was hoping to replace @cedric's JCommander command-line parser with something a little bit more kotlin friendly. After a couple of weekends I came up with `getoptk`: https://github.com/EmpowerOperations/getoptk. I'm using it on a couple of personal projects but I dont have particularly complex requirements for a command line parser. I would very much appreciate any thoughts or feedback,
👍 1
c

christoph.pickl

04/17/2017, 8:07 AM
nice work, will have a look at it
s

sreich

04/17/2017, 9:21 AM
@groostav Looks pretty cool. Does it have --help and -h ? Jcommander is nice because it does that automatically in a good unix style when you enable it, you just set a description and a name for each param. I'll keep an eye on this, looks quite nice thus far.
What's its behavior on unrecognizable options? Others can be set to fail or ignore
Does it allow deconstructing 127.0.0.1:8080 ?
Your read me needs a converter example
Can it handle static settings objects? Like a global Settings class?
Can it also parse --foo "some --ignoreMe thing" as you'd expect (as a single string)
g

groostav

04/17/2017, 6:31 PM
yeah, @sreich : re
--help
messages: I was working on generating nice help messages before I created that repo. I'm hoping to finish up that work soon. - unrecognized options should generate reasonably nice error messages, akin to
Copy code
com.empowerops.getoptk.unrecognized option: -g
whatever.exe --recognized 1.234 -g 2.34
                                ~~ ~~~~
Of course, a really obvious ability would be to allow you to ignore unrecognized options. i should say I hate this behaviour but i understand it has many use cases. Will fix. - regarding converter example: your very much correct, will fix - ahh yes, I mean unfortunately a lot of that is on exactly what the shell is doing. I'll spend some time seeing exactly what the various shells are going to do and maybe documenting them, and making sure that behaviour is as expected
s

sreich

04/17/2017, 7:10 PM
Ok great, with all those fixed\added it'll be looking quite nice.
@groostav oh, yeah.. Can it handle options getting stored in static (kotlin objects)?, Example of that would be nice
g

groostav

04/18/2017, 5:29 AM
yeah i believe thats doable
alright @sreich I got all of your comments on
getoptk
into
master
, its still very much alpha as there are a couple `TODO()`s and exceptions thatl get raised for a number of use cases, but its shaping up. Still dont have the option to ignore unrecognized options but that'l come. take a look: https://github.com/EmpowerOperations/getoptk/blob/master/README.md
👍 3