JSPM

group-args

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20308
  • Score
    100M100P100Q138855F
  • License MIT

My praiseworthy module

Package Exports

  • group-args

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (group-args) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

group-args Build Status

CLI helper to group commandline arguments

Install

$ npm install --save group-args

Usage

node ./cli.js --foo --bar something --group-a 1 --group-b 2
const groupArgs = require('group-args');

// process.argv: [
groupArgs('group');
//=> {foo: true, bar: 'something', group: { a: 1, b: 2 }}

API

groupArgs(key, [options], [minimistOptions])

key

Type: string|array|object

Group arguments by key. When passing an object it is Could be 'key', ['key1','key2'], {alias1: 'key1', alias2: 'key2'}

options

argv

Type: array|object
Default: process.argv.slice(2)

Arguments array or already parsed arguments.

delimiter

Type: string
Default: -

Delimiter between group identifier & key.

strict

Type: bool
Default: true

Disable to allow camelCased arguments provided by e.g. meow

alias

Type: string
Default: undefined

Alias for identifier (short opt)

camelCase

Type: bool
Default: true

camelCase grouped arguments

minimistOptions

See minimist

License

MIT © Ben Zörb