Пример:
Код: Выделить всё
from invoke import task
@task(help={'out_file:': 'Name of the output file.',
'in_files': 'List of the input files.'})
def pdf_combine(out_file, *in_files):
print( "out = %s" % out_file)
print( "in = %s" % list(in_files))
Приведенный выше код дает
Код: Выделить всё
$ invoke pdf_combine -o binder.pdf -i test.pdf test1.pdf
No idea what '-i' is!
Код: Выделить всё
$ invoke pdf_combine -o binder.pdf -i test.pdf test1.pdf
No idea what 'test1.pdf' is!
Код: Выделить всё
$ invoke pdf_combine -o binder.pdf -i test.pdf
out = binder.pdf
in = ['t', 'e', 's', 't', '.', 'p', 'd', 'f']
Код: Выделить всё
$ invoke pdf_combine -o binder.pdf test.pdf test1.pdf test2.pdf
out = binder.pdf
in = [test.pdf test1.pdf test2.pdf]
Подробнее здесь: https://stackoverflow.com/questions/357 ... n-pyinvoke
Мобильная версия