项目作者: zacanger

项目描述 :
Tiny cli args module
高级语言: JavaScript
项目地址: git://github.com/zacanger/zrgs.git
创建时间: 2018-08-03T17:01:23Z
项目社区:https://github.com/zacanger/zrgs

开源协议:GNU Lesser General Public License v3.0

下载


zrgs

Tiny cli args module.

Support with PayPal Patreon ko-fi


Installation

npm i zrgs

Usage

zrgs does the bare minimum. It’s just a couple of helper functions. If you
want an interactive CLI library, automatic help/usage, configurable aliases,
complex arguments, or any other nice features, you should probably use a
different library.

zrgs assumes you want short, long, and GNU-style long flags. hasFlag('foo')
will return true if the first argument is -f, -foo, or --foo. args is
process.argv.slice(2). And that’s it.

  1. const { hasFlag, args } = require('zrgs')
  2. if (hasFlag('help')) {
  3. // display help
  4. } else if (hasFlag('something')) {
  5. handleSomething(args)
  6. }

LICENSE