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

前端 未结 8 1427
难免孤独
难免孤独 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

    We are running Linux, a mostly POSIX-compliant OS. POSIX standards it should be: Utility Argument Syntax.

    • An option is a hyphen followed by a single alphanumeric character, like this: -o.
    • An option may require an argument (which must appear immediately after the option); for example, -o argument or -oargument.
    • Options that do not require arguments can be grouped after a hyphen, so, for example, -lst is equivalent to -t -l -s.
    • Options can appear in any order; thus -lst is equivalent to -tls.
    • Options can appear multiple times.
    • Options precede other nonoption arguments: -lst nonoption.
    • The -- argument terminates options.
    • The - option is typically used to represent one of the standard input streams.

提交回复
热议问题