JSPM

  • Created
  • Published
  • Downloads 2557567
  • Score
    100M100P100Q264133F
  • License MIT

Generates command-line usage information

Package Exports

  • command-line-usage
  • command-line-usage/lib/command-line-usage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (command-line-usage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

view on npm npm module downloads per month Build Status Dependency Status

command-line-usage

Generates column-layout usage information for a command-line parser (e.g. command-line-args).

Synopsis

Where example/my-app.js looks like this

module.exports = {
    options: {
        title: "my-app",
        description: "Generates something useful",
        forms: [
            "$ cat input.json | my-app [<options>]",
            "$ my-app <files>"
        ],
        groups: {
            main: { 
                title: "Main options",
                description: "This group contains the most important options."
            },
            misc: "Miscellaneous"
        },
        footer: "Project home: https://github.com/me/my-app"
    },
    data: [
        { name: "one", alias: "a", type: String, group: "main",
          description: "The first option"
        },
        { name: "two", type: Number, alias: "b", group: "main",
          description: "The second option"
        },
        { name: "three", alias: "c", type: String, group: "misc",
          description: "The third option"
        },
        { name: "four", type: Number, alias: "d", group: "misc",
          description: "The fourth option"
        }
    ]
};

This command:

$ command-line-usage example/my-app.js

Outputs this:


  my-app
  Generates something useful

  Usage
  $ cat input.json | my-app [<options>]
  $ my-app <files>

  Main options
  This group contains the most important options.

  -a, --one <string>     The first option
  -b, --two <number>     The second option

  Miscellaneous
  -c, --three <string>   The third option
  -d, --four <number>    The fourth option

  Project home: https://github.com/me/my-app
  

command-line-usage

usage(cliOptions, options) ⇒ string

Kind: Exported function

Param Type Description
cliOptions Array.<cliOption> the CLI options
options object Options
[options.title] string
[options.description] string
[options.forms] string | Array.<string>
[options.groups] object
[options.footer] string
[options.hide] string | Array.<string>

© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.