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

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

    0 讨论(0)
  • 2020-11-30 16:49

    Microsoft has their own Command Line Standard specification:

    This document is focused at developers of command line utilities. Collectively, our goal is to present a consistent, composable command line user experience. Achieving that allows a user to learn a core set of concepts (syntax, naming, behaviors, etc) and then be able to translate that knowledge into working with a large set of commands. Those commands should be able to output standardized streams of data in a standardized format to allow easy composition without the burden of parsing streams of output text. This document is written to be independent of any specific implementation of a shell, set of utilities or command creation technologies; however, Appendix J - Using Windows Powershell to implement the Microsoft Command Line Standard shows how using Windows PowerShell will provide implementation of many of these guidelines for free.

    0 讨论(0)
提交回复
热议问题