我将写一些非常基本的东西,以解释我希望实现的目标。我写了一些代码来做一些有趣的 WordPress 管理。该程序将创建实例,但也会为 apache 创建 https 设置。
我想要它做什么以及我在哪里遇到问题:(如果您在wp cli上运行帮助,您将确切地看到我想要发生的事情......但我不是开发人员,所以我会喜欢一些帮助)
python3 testcommands.py --help
Usage: testcommands.py [OPTIONS] COMMAND [ARGS]...
This is the help
Options:
--help Show this message and exit.
Commands:
https Commands for HTTPS
wp Commands for WP
python3 testcommands.py https --help
Usage: testcommands.py [OPTIONS] COMMAND [ARGS]...
This is the help
Options:
--help Show this message and exit.
Commands:
create Creates config for HTTPS
sync Syncs config for Apache
Run Code Online (Sandbox Code Playgroud)
我的基本代码:
import click
@click.group()
def cli1():
pass
"""First Command"""
@cli1.command('wp') …Run Code Online (Sandbox Code Playgroud)