Skip to content

gabrielcsapo/woof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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);