Are there some rules or pattern on how to write the terminal help menu of a program on linux?

Usually I use these arguments: -? or -h or -H to display the help of my program but is there a rule about that as well?

有帮助吗?

解决方案

The output for --help is not really a menu, just a help message.

There are some coding rules, in particular the GNU coding standards specify something about --help (and also --version). I strongly suggest supporting both of them; as a user, I am pissed off by the few programs not understanding --help.

And the GNU libc provides several ways for providing that --help. I suggest looking into argp, but you could use getopt.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top