是否可以在可选参数上添加一些小节?所以用户更容易理解哪个参数与哪个参数相关?
我是说举个例子
psql --help
,输出这个(我不知道psql解析库使用了哪些参数,但给出了一个理想输出的好例子):
Usage:
psql [OPTION]... [DBNAME [USERNAME]]
General options:
-c,
-d,
-f,
-l,
-v,
set psql variable NAME to VALUE
(e.g., -v ON_ERROR_STOP=1)
-V,
-X,
-1 ("one"),
execute as a single transaction (if non-interactive)
-?,
Input and output options:
-a,
-b,
-e,
-E,
-L,
-n,
-o,
-q,
-s,
-S,
Output format options:
-A,
-F,
field separator for unaligned output (default: "|")
-H,
-P,
-R,
record separator for unaligned output (default: newline)
-t,
-T,
-x,
-z,
set field separator for unaligned output to zero byte
-0,
set record separator for unaligned output to zero byte
Connection options:
-h,
-p,
-U,
-w,
-W,
For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within psql, or consult the psql section in the PostgreSQL
documentation.
Report bugs to <pgsql-bugs@postgresql.org>.
有些章节像
General options
,
Input and output options
等等。
用
argparse
我只得到
positional arguments
和
optional arguments
选项。是否可以为可选参数创建一些子部分?