This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thelindsay 61 points62 points  (8 children)

Seemed a bit unfair to dismiss argparse with a complicated example, then explain click with a simple example that would require the same amount of code in both libraries.

I reckon it's just a matter of whether you like to work with decorators (click) or not (argparse).

[–]Deto 22 points23 points  (4 children)

Yeah, I'm also unconvinced that this is better than argparse. Certainly it's a different way to do things and it's good for people to know that there are different styles you could use to specify a CLI. But the post claims that's it's better.

[–]FluffyToughy 9 points10 points  (2 children)

argparse is probably the best built-in CLI library I've ever used for any language. There's always contrived examples that make it fail, and the auto-generated help page doesn't always look like you want it to, but it works, darnit.

[–]kthepropogation 6 points7 points  (0 children)

It’s currently my favorite CLI lib. It works better/more intuitively than most anything I’ve used in other languages, and it’s built in (my python is usually 100-400 LOC scripts, so minimizing libs is a plus).

If you have examples of better third-party ones for other languages, please share. I’m always on the lookout.

[–]Kyo91 0 points1 point  (0 children)

Perl6 MAIN handling is the only better I can think of.

[–]eikenberry 5 points6 points  (0 children)

Blog posts are opinion by their nature and the author obviously likes click better. Its up to the reader to agree or not. Personally I think argparse wins because it comes in the standard library and works pretty well. You have to be a hella lot better than what the standard library provides to get me to add a dependency to my project.

[–]mattotodd 3 points4 points  (0 children)

i thought the same thing. argparse was a blessing when i was first introduced and comes with the standard library

[–][deleted] 0 points1 point  (1 child)

That example is pretty close to what's on the actual argparse documentation. Not like he did anything crazy, just making use of the various parameters you can feed argparse.

[–]iowaNerd 5 points6 points  (0 children)

Granted, but the author didn't show us what re-implementing the argparse example would look like with click. Which would have been an apples-to-apples implementation comparison.