0

I like how simple it is to create a cli runnable task like this:

@task
def my_command(ctx, myarg="abc"):
    ctx.run('some command')

I really want to maintain that simplicity if possible, but I also want to define a default set of params ALL my tasks will support.

For example all of my invoke commands should support switches like --human-readable, --filter=<expression>, --limit=<number>, etc.

Is there a way to define my default switches in one place and not have to add them to every one of my task functions definitions? Is there an aspect oriented-ish way to do this where they get injected somehow? Does pyinvoke support using a decorator for something like this?

red888
  • 27,709
  • 55
  • 204
  • 392

0 Answers0