🐢 command line applications made as easy as fetch
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
example
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
index.js
package.json
util.js

README.md

woof

command line applications made as easy as fetch



Npm Version Build Status Coverage Status Dependency Status devDependency Status npm npm

Installation

npm install woof

Usage

const cli = woof(`
  Usage
    $ foo <input>

  Commands:
    start, -s               Starts foo!
    compile, -c             Compile foo!

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

  Examples
    $ foo unicorns --rainbow
    🌈 unicorns 🌈

    $ foo --unicorn rainbow
    🌈 πŸ¦„ 🌈

    $ foo --unicorn sea
    🌊 πŸ¦„ 🌊
`, {
  commands: {
    start: {
      alias: 's'
    },
    compile: {
      alias: 'c'
    }
  },
  flags: {
    rainbow: {
      type: 'boolean',
      alias: 'r'
    },
    unicorn: {
      type: 'string',
      alias: 'u',
      default: 'rainbow',
      validate: function (value) {
        return ['rainbow', 'sea'].indexOf(value) === -1 ? `please providate a valid unicorn type (rainbow|sea), '${value}' is not a valid option` : true
      }
    }
  }
});

console.log(cli);