Skip to content
JavaScriptExpertPublic
forked from lukeed/mri

About

Quickly scan for CLI flags and arguments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

33 Commits

Folders and files

Repository files navigation

mri Build Status

Quickly scan for CLI flags and arguments

This is a very basic, fast, and lightweight alternative to minimist. It only exists because I find that I usually don't need most of what minimist has to offer.

For now, there's no configuration options. Instead, mri just parses raw CLI flags (single or group) and assigns a value to those keys.

Note: Defaults, aliases, and type-casting are not supported. However, this may change in the future. 🤔

Install

$ npm install --save mri

Usage

$ demo-cli --foo --bar=baz -mtv -- hello world
const mri = require('mri');

const args = process.argv.slice(2);

mri(args);
//=> { _: ['hello', 'world'], foo:true, bar:'baz', m:true, t:true, v:true }

API

mri(args)

args

Type: array
Default: []

An array of arguments to parse. For CLI usage, send process.argv.slice(2). See process.argv for info.

Benchmarks

mri
  --> 348,312 ops/sec ±0.20% (94 runs sampled)
yargs
  --> 16,388 ops/sec ±0.56% (89 runs sampled)
minimist
  --> 144,801 ops/sec ±0.81% (89 runs sampled)

License

MIT © Luke Edwards

About

Quickly scan for CLI flags and arguments

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages