是否有用于破折号和参数的标准命令行约定?

编程入门 行业动态 更新时间:2024-10-10 19:17:16
本文介绍了是否有用于破折号和参数的标准命令行约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

是否有用于破折号和参数的标准命令行约定?

本文发布于:2023-11-22 01:38:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615473.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:破折号   命令行   参数   标准

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!