4 ms·
> https://docs.python.org/3/library/argparse.html https://docs.python.org/3/library/argparse.html is great Argparse is okay (and being in stdlib makes it alway
by dragonwriter 6y ago
> https://docs.python.org/3/library/argparse.html https://docs.python.org/3/library/argparse.html is great
Argparse is okay (and being in stdlib makes it always-available), but it's no click. https://click.palletsprojects.com/en/7.x/ https://click.palletsprojects.com/en/7.x/
- 40four 6y agoThumbs up for 'Click'. I used it for a project once, and I was really happy with it. Easy to use, good docs. Would use it again.
- pletnes 6y agoIt’s fantastic and should be used by most CLI programs. Argparse is much faster and avoids having a dependency, so it does serve a purpose.
- gavinray 6y agoGoogling the library appears to be about ~8,000 lines of code (core.py is ~2,000 alone). Is that really reasonable sounding to most people for parsing CLI input/output and display manpages or helptext?
- dastx 6y agoI suppose it depends on the use case. Personally I've always thought argparse is good enough, and have never hit a roadblock "because I'm using argparse" so to say. Having said that, I do like the pattern click is going for. If it argparse allowed the same pattern, in my opinion that would be cool, and it would probably be my first choice.
- meddlepal 6y agoI'm not trying to be antagonistic here... but who cares how many lines it has unless you plan to maintain it?
- 40four 6y agoI didn’t mean to suggest we should reach for Click for simple help/manpage display. The case I used it for was much more complex. What I liked about it was the easy to use API, clear documentation & examples, and readable patterns. For simple text display, I like the solution from the article, and I learned something new about bash scripts. Also, I learned from comments you can use heredoc in bash!
- mey 6y agoThis is why I love the HN community, learning something new every day. (Happy 10,000) I use argparse because it is stdlib, but will checkout click!