Hacker News new | ask | show | jobs
by jobeirne 2212 days ago
I recently wrote this (https://github.com/jamesob/clii) because I can't stand click and got sick of having to check the argparse docs every time I wanted to write a CLI. I guarantee you'll spend a tenth of the time trying to figure out how to use this thing, it has no dependencies, and is implemented in a single vendor-friendly file.
4 comments

There is also Typer[1]

[1] https://github.com/tiangolo/typer

Similar interface, different design goals. This lib has 6x the code, dependencies, and isn't as easy to vendor/audit.
Yep, good work! Though I do think the name "clii" could generate some confusion. Maybe not though.
Thanks!
Does it handle help automatically? If not, and you think that'd be a valuable addition, I would like to take a crack at implementing it :)

What I mean is if you execute script.py help, it will print out the possible options, along with their docstrings, or maybe just the first line.

It does parse docstrings in a very basic way (https://github.com/jamesob/clii#help-text-from-docstrings) but if you end up hacking in something you want, PRs are welcome.
You really nailed this, imho. Awesome work.

What is the reason for requiring Python >=3.7?

Thanks. That's a really good point - maybe it's usable on earlier versions. Can't remember why I thought otherwise, will have to test.
This looks really good actually - bullshit-minimising. Will check it out.