是否有用于破折号和参数的标准命令行约定? [英] Are there any standard Command line conventions for dashes and arguments?

查看:91
本文介绍了是否有用于破折号和参数的标准命令行约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于何时使用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.

这篇关于是否有用于破折号和参数的标准命令行约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆