Is there a “standard” format for command line/shell help text?

前端 未结 8 1428
难免孤独
难免孤独 2020-11-30 16:30

If not, is there a de facto standard? Basically I\'m writing a command line help text like so:

usage: app_name [opti         


        
8条回答
  •  时光取名叫无心
    2020-11-30 16:42

    yes, you're on the right track.

    yes, square brackets are the usual indicator for optional items.

    Typically, as you have sketched out, there is a commandline summary at the top, followed by details, ideally with samples for each option. (Your example shows lines in between each option description, but I assume that is an editing issue, and that your real program outputs indented option listings with no blank lines in between. This would be the standard to follow in any case.)

    A newer trend, (maybe there is a POSIX specification that addresses this?), is the elimination of the man page system for documentation, and including all information that would be in a manpage as part of the program --help output. This extra will include longer descriptions, concepts explained, usage samples, known limitations and bugs, how to report a bug, and possibly a 'see also' section for related commands.

    I hope this helps.

提交回复
热议问题