kawkah
CLI argument parser with middleware support.
Last updated a year ago by blujedis .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install kawkah 
SYNC missed versions from official npm registry.

An extensible command line parsing utility with middleware. Although fairly stable this module is not in production use as of 8/2018.

Key benefits of Kawkah are that it allows you to extend the validation pipeline and parsing via middleware. This allows you to easily create hooks for tracking usage or to add some sort of custom validation step.

Another key feature is the ability to build help groups for display. Kawkah is very customizable on this front. You can mix and match just about anything from examples to options to commands under a single heading with ease.

This is done by using namespaces. you might do something like:

kk.group('MyGroup', 'commandName.option', 'examples.name', 'Some static string of text');

We'll provide more on this soon...

Install

$ npm install kawkah

Usage

Here are the basics. After instantiating define your args, flags and other settings then call .listen() to have Kawkah listen for process.argv arguments.

import { Kawkah } from 'kawkah';

// OR

const Kawkah = require('kawkah').Kawkah;
const kk = new Kawkah({ /* options */ });

kk
  .arg('order', {
    coerce: v => v.toUpperCase()
  })
  .flag('toppings', {
    type: 'array',
    validate: /(cheese|mushroom|ham)/
  })
  .flag('deep-dish')
  .listen('order --toppings cheese --toppings ham --deep-dish');

// RESULT

const result = {
  {
    _: [ 'ORDER' ],
    __: [],
    toppings: [ 'cheese', 'ham' ],
    deepDish: true,
    '$0': 'app',
    '$command': null
  }
}

Table of Contents

The documentation listed in this table of contents is here for convenience. If you find an error we suggest heading over to the Generated Docs. These tend to be pretty accurate given the cannot be generated without the project building. We try to keep examples up to date but there's only so much time. Feel free to create a PR if you see a mistake!

Docs

Documentation generated from source.

See https://blujedis.github.io/kawkah/

Change

See CHANGES.md

License

See LICENSE.md

Current Tags

  • 1.0.27                                ...           latest (a year ago)

28 Versions

  • 1.0.27                                ...           a year ago
  • 1.0.26                                ...           a year ago
  • 1.0.25                                ...           a year ago
  • 1.0.24                                ...           a year ago
  • 1.0.23                                ...           a year ago
  • 1.0.22                                ...           a year ago
  • 1.0.21                                ...           a year ago
  • 1.0.20                                ...           a year ago
  • 1.0.19                                ...           a year ago
  • 1.0.18                                ...           a year ago
  • 1.0.17                                ...           a year ago
  • 1.0.16                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (12)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |