У меня есть цепочка команд, что -то вроде этого. < /pt>
@click.group()
@click.option('--debug/--no-debug', default=False)
def cli(debug):
click.echo('Debug mode is %s' % ('on' if debug else 'off'))
@cli.command()
def sync1():
click.echo('Syncing 1')
@cli.command()
def sync2():
click.echo('Syncing 1')
< /code>
tool.py
Usage: tool.py [OPTIONS] COMMAND [ARGS]...
Options:
--debug / --no-debug
--help Show this message and exit.
Commands:
sync1
sync2
< /code>
This is how I would run my command in a nested fashion.
tool.py sync1 --help
tool.py sync2 --help
< /code>
now imagine every leaf level command (i.e sync1 and sync2 in this case) calls some API and I want to print the name of that API.
What is the best way to achieve without changing all leaf level function (i.e sync1/sync2).
Подробнее здесь: https://stackoverflow.com/questions/617 ... n-commands
Добавить команду во все команды уровня листьев в командах цепочки Python Click ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как Python Click Click Library Randlection, которые являются флагами и верны по умолчанию?
Anonymous » » в форуме Python - 0 Ответы
- 3 Просмотры
-
Последнее сообщение Anonymous
-