如果没有,是否存在一个事实上的标准?基本上,我正在编写命令行帮助文本,如下所示:
usage: app_name [options] required_input required_input2
options:
-a, --argument Does something
-b required Does something with "required"
-c, --command required Something else
-d [optlistitem1 optlistitem 2 ... ] Something with list
我基本上只是阅读了各种工具的帮助文本,但是否有指南列表或其他内容?例如,我是用方括号还是圆括号?如何使用空格?如果参数是一个列表呢?谢谢!
我们运行的是Linux,一个基本符合posix的操作系统。它应该是POSIX标准:实用程序参数语法。
An option is a hyphen followed by a single alphanumeric character,
like this: -o.
An option may require an argument (which must appear
immediately after the option); for example, -o argument or
-oargument.
Options that do not require arguments can be grouped after a hyphen, so, for example, -lst is equivalent to -t -l -s.
Options can appear in any order; thus -lst is equivalent to -tls.
Options can appear multiple times.
Options precede other nonoption
arguments: -lst nonoption.
The -- argument terminates options.
The - option is typically used to represent one of the standard input
streams.