词条 | Usage message |
释义 |
}} In computer programming, a usage message or help message refers to a brief message displayed by a program that utilizes a command-line interface for execution. This message usually consists of the correct command line usage for the program and includes a list of the correct command-line arguments or options acceptable to said program. Usage messages are utilized as a quick way for a program to inform the user of proper command syntax, and should not be substituted for proper error messages or for detailed documentation such as a man page. PatternOn Unix-like platforms, usage messages usually follow the same common pattern:
ExamplesHere is an example based on the NetBSD source code style guide: This would indicate that "program" should be called with:
ImplementationTo print a usage statement in a shell script, one might write: Anti-patternsA usage statement is not an error message, but is often used as a lazy way to avoid printing a useful error message. A properly written command line program will print a succinct error message that describes the exact error made by the caller rather than printing the usage statement and requiring the user to figure out what the mistake was. If a user fails to pass the correct number of arguments, for example, a single line stating that an argument is missing is far more useful than several pages of output providing a general usage. As a corollary, a usage statement should only be printed when specifically requested by the user (via --help, or -h, or -?, or some similar flag or argument) and should be written to stdout {{Citation needed|date=March 2018}}. See also
1 : Online help |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。