JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 22631
  • Score
    100M100P100Q141257F
  • License MIT

command-line-commands

Package Exports

  • command-line-commands

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-commands) 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 js-standard-style

documentation in progress

command-line-commands

Add a git-like command interface to your app.

Example

const commandLineCommands = require('command-line-commands')

const cli = commandLineCommands([
  { name: 'help' },
  { name: 'run', definitions: [ { name: 'why', type: String } ] }
])

const command = cli.parse()

switch (command.name) {
  case 'help':
    console.log("I can't help you.")
    break
  case 'run':
    console.log(`${command.options.why}: this is not a good reason.`)
    break
  default:
    console.log('Unknown command.')
}

CommandLineCommands ⏏

Kind: Exported class

new CommandLineCommands(commands)

Param Type
commands array

commandLineCommands.parse([argv]) ⇒ object

Kind: instance method of CommandLineCommands

Param Type
[argv] array

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