posix 标志的命名约定

Naming convention for posix flags

我正在编写一个允许设置多个 Posix 标志的控制台应用程序。

这是我目前使用的。标志中的单词用破折号连接:

  -p, --broker-port int     Broker Port (default 1883)
  -u, --broker-url string   Broker URL (default "localhost")
  -c, --client-id string    MQTT Client Id
  -r, --room string         Room where sensor is located (default "myroom")
  -f, --floor string        Floor, where room is located (default "basement")

不过,我也看到过使用 CamelCase 来连接 pflag 的应用程序。

官方GNU coding standard没有说明如何在posix flags中连接单词。

正确的方法是什么?

谢谢

答案似乎隐藏在 GNU 文档中 here

GNU adds long options to these conventions. Long options consist of ‘--’ followed by a name made of alphanumeric characters and dashes. Option names are typically one to three words long, with hyphens to separate words. Users can abbreviate the option names as long as the abbreviations are unique.

你得到的是符合惯例的;骆驼案没有。