Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have used both argp and Kong. I consider them two of the best Go CLI libraries for different reasons. Kong has a full set of advanced functionality like flag groups and associating environment variables with options. It is highly useful in a larger project with a complex CLI. For a simple command-line interface, I prefer argp's small API and defaults, like exit with status 2 on bad usage. (Disclosure: I contributed this default to argp.)

Kong 1.7 has a disadvantage when it comes to negative numbers. argp parses `foo --bar -1` as `foo --bar=-1` the way you expect when `--bar` takes a value, but Kong treats `-1` as a flag.

Edit: Expanded the first paragraph.



> argp parses `foo --bar -1` as `foo --bar=-1` the way you expect when `--bar` takes an value, but Kong treats `-1` as a flag.

This seems a bug in Kong. Has someone reported it?


Yes, see https://github.com/alecthomas/kong/issues/315. It may be nontrivial to change.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: