Getting Started

woof helps make command line applications

Install

             npm install woof -g 
          

Usage

const woof = require('woof');
const cli = woof(`
  Usage
  $ foo [input]

  Options
  --unicorn, -u [type]    Include a unicorn [rainbow|sea]

  Examples

  $ foo --unicorn rainbow
  🌈 🦄 🌈
 `, {
  flags: {
    unicorn: {
      type: 'string',
      alias: 'u',
      default: 'rainbow'
    }
  }
});

Options

 woof(helpMenu, options) 

  • helpMenu (mandatory|String) the string to be output if help, --help are parsed from args
  • defaultCommand (optional|String) the default command to select given that no commands are found via the arguments passed in.
  • options (mandatory|Object) options object
  • options.version (optional|String) version to be output if version, --version are parsed from args, by default this is the version from package.json
  • options.args (optional|Array) instead of parsing from process.argv this array will be used to parse arguments from.
  • options.flags (optional|Object) describes the flags that should be parsed. The key is the name of the argument that the value will be mapped too.

    $name: {
      type: 'string|boolean|number',
      alias: String,
      default: String
    }
  • options.commands (optional|Object) describes the commands that should be parsed. The key is the name of the argument that the value will be mapped too, if the command is found, it will be set to true.

    $name: {
      alias: String,
    }