6 ms·
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 rem
by dankilman 12y ago
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/ http://argh.readthedocs.org/en/latest/
- icebraining 12y agoYou'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)
- u124556 12y agoThe command decorator is nice, but the group decorator feels wrong, why create a function that does nothing just to decorate it? I'd rather use `cli = click.Group()`.