Re:Click – Python library for command-line interfaces
by eddd on Thursday April 24, 2014 @08:32AM
(#7639808)
https://readthedocs.org/projects/argh/
[ Parent
| on HN ]
Re:Click – Python library for command-line interfaces
by dankilman on Thursday April 24, 2014 @08:48AM
(#7639900)
I also really like argh, though it seems the provided link documents an api the mandates decorators and in fact what I like about argh is that functions can remain clean. http://argh.readthedocs.org/en/latest/
Re:Click – Python library for command-line interfaces
by icebraining on Thursday April 24, 2014 @10:29AM
(#7640456)
You're never forced to use decorators, they're just syntactic sugar.
Their example:
@click.command()
@click.option('--count', default=1, help='number of greetings')
@click.option('--name', prompt='Your name',
help='the person to greet', required=True)
def hello(count, name):
for x in range(count):
print('Hello %s!' % name)
Could be written as: def hello(count, name):
for x in range(count):
print('Hello %s!' % name
hello = click.option('--name', prompt='Your name',
help='the person to greet', required=True)(hello)
hello = click.option('--count', default=1, help='number of greetings')(hello)
hello = click.command(hello)