我试图弄清楚如何对 Click 中的命令进行分类,以类似于kubectl其分隔命令的方式所使用的结构。
例如,在普通的 Click 帮助输出中,我们有:
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
A CLI tool
Options:
-h, --help Show this message and exit.
Commands:
command1 This is command1
command2 This is command2
command3 This is command3
command4 This is command4
Run Code Online (Sandbox Code Playgroud)
相反,对我的使用来说最理想的是进行分离以更好地对命令结构进行分类。
例如:
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
A CLI tool
Options:
-h, --help Show this message and exit.
Specific Commands for X:
command1 This is command1
command2 This is command2
Specific Commands for Y:
command3 This is command3
command4 …Run Code Online (Sandbox Code Playgroud)