关于何时使用2个破折号,1个破折号或根本不使用任何选项并且仅按顺序读取输入的命令行约定是什么?
What are the command-line conventions regarding when to use 2 dashes, 1 dash, or simply no options at all and simply read inputs in order?
我意识到有很多变体,但是是否有任何约定作为行业标准脱颖而出(例如Java,C或Python)?
I realize there are many variants, but do any conventions stand out as the industry standard (say in Java, or C, or Python)?
推荐答案阅读Python的optparse模块的背景部分,它会回答一些问题您的问题,并举例说明一些常见的自变量格式化标准。 optparse模块作者建议一种样式,该样式应大致与用于命令行参数的POSIX约定,并添加了来自GNU编码标准的--double-dashed-long-arguments。
Read up on the background section of Python's optparse module, it answers some of your questions and exemplifies with some common argument formatting standards seen in the wild. The optparse module author recommends a style that roughly corresponds to the POSIX conventions for command line arguments, with the addition of --double-dashed-long-arguments which comes from the GNU coding standard.
更多推荐
是否有用于破折号和参数的标准命令行约定?
发布评论