问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/18877063/menu-help-syntax-of-a-program