securityos/node_modules/minimisted
Berkeley 927854894b First commit 2024-09-06 12:32:35 -03:00
..
.github/workflows First commit 2024-09-06 12:32:35 -03:00
.bmp.yml First commit 2024-09-06 12:32:35 -03:00
.editorconfig First commit 2024-09-06 12:32:35 -03:00
README.md First commit 2024-09-06 12:32:35 -03:00
index.js First commit 2024-09-06 12:32:35 -03:00
package.json First commit 2024-09-06 12:32:35 -03:00
test.js First commit 2024-09-06 12:32:35 -03:00

README.md

minimisted v2.0.1

CI codecov js-standard-style

A handy wrapper of minimist

Install

npm install minimisted

Usage

You can write your cli like the following:

// Your cli's entry point
const main = (argv) => {
}

require('minimisted')(main)

where argv is the command line options parsed by minimist i.e. minimist(process.argv.slice(2)).

Using object destructuring syntax, you can write it like the following:

/**
 * @param {boolean} help Shows help message if true
 * @param {boolean} version Shows the version if true
 * ...
 * @param {string[]} _ The parameters
 */
const main = ({ help, version, _ }) => {
}

require('minimisted')(main)

API

const minimisted = require('minimisted')

minimisted(main[, opts[, argv]])

  • @param {Function} main The main function
  • @param {Object} opts The option which is passed to minimist's 2rd arguments
  • @param {string} argv The command line arguments. Default is process.argv.slice(2).

This calls main with command line options parsed by the minimist with the given options.

License

MIT