For example:
import clip
def ab(f):
f = clip.opt('-b')(f)
f = clip.arg('a')(f)
return f
app = clip.App()
@app.main()
@clip.opt('-c')
@ab
@clip.opt('-d')
def main(c, a, b, d):
print c, a, b, d
if __name__ == '__main__':
try:
app.run()
except clip.ClipExit:
pass
These utility decorators would take a function, add several clip args/opts to it, and return it. One real-world example is a @time decorator that would apply start, end, and duration arguments to a command. Because composability!
For example:
These utility decorators would take a function, add several clip args/opts to it, and return it. One real-world example is a
@timedecorator that would apply start, end, and duration arguments to a command. Because composability!