小编Ric*_*ich的帖子

对 Python Click 中的帮助输出进行分类

我试图弄清楚如何对 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)

python python-click python-3.8

2
推荐指数
1
解决办法
579
查看次数

标签 统计

python ×1

python-3.8 ×1

python-click ×1