Hi. I've been working on a decorator that generates a command-line interface for a function based on its signature. Have a look and tell me what you think!
https://github.com/ninjaaron/lazycli
https://github.com/ninjaaron/lazycli
lazycli: zero-effort command-line interfaces
|
Hi. I've been working on a decorator that generates a command-line interface for a function based on its signature. Have a look and tell me what you think!
https://github.com/ninjaaron/lazycli
Nov-06-2018, 06:24 PM
Looks cool!
Nov-06-2018, 06:32 PM
(This post was last modified: Nov-06-2018, 06:32 PM by Gribouillis.)
(Nov-06-2018, 05:48 PM)ninjaaron Wrote: Have a look and tell me what you think!Frankly speaking, there are now many modules that wrap argparse to provide a simplified API to generate command-line interfaces. So the question is what does lazycli have that other systems don't? It doesn't appear to be fundamentally simpler than argh or click for example.I recently started using plumbum.cli. I like its approach of subcommands which makes them full-fledged cli applications that can be easily separated from the main application. It is an achievement in terms of modularity. (Nov-06-2018, 06:24 PM)micseydel Wrote: Looks cool!I'm glad you like it! (Nov-06-2018, 06:32 PM)Gribouillis Wrote:(Nov-06-2018, 05:48 PM)ninjaaron Wrote: Have a look and tell me what you think!Frankly speaking, there are now many modules that wrap argparse to provide a simplified API to generate command-line interfaces. So the question is what does Thanks for taking a look! The difference between lazycli and click is pretty big! click is extremely full-featured and composable. However, each argument is its own function decorator, so there is a lot more boiler-plate than lazycli . (also, click is NOT an argparse wrapper. It wraps optparse.)argh looks very similar to lazycli , in the basic usecase. I've never seen it before, but I might not have written lazycli if I'd known about it! There are two main differences that I can see:
The main goal of lazycli is to do as much as possible by looking at the function signature and save the programmer from having to think about their CLI. It's aimed especially at prototyping, where you want to focus on code more than interface, but you need just a little more than what sys.argv is giving you. argh would fit the same usecase well.I really like the interface of plumbum.cli that you posted, also. Looks great for more involved interfaces.
Nov-07-2018, 08:58 AM
Just to mention python-fire when it comes to quick CLI interfaces. Didn't use it but also look simple and quick and doing a lot instead of you.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs (Nov-07-2018, 08:58 AM)buran Wrote: Just to mention python-fire when it comes to quick CLI interfaces. Didn't use it but also look simple and quick and doing a lot instead of you. Thanks for the info. It looks pretty cool, but it also looks a little... hm... magical. But it does look easy to use. |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
get any domain's Alexa rank via command line | rootVIII | 2 | 4,055 |
Oct-14-2018, 08:34 PM Last Post: rootVIII |