args-and-flags

3.0.3 • Public • Published

args-and-flags

An argument parser based on minimist that offers named arguments, flags, validation, and default or required values.

npm standard conduct

Install

npm install --save args-and-flags

Node v8 and higher is required

Usage

import ArgsAndFlags from 'args-and-flags'

const options = {
	args: [
		{
			name: 'hello',
			type: 'string',
			help: 'an argument for saying hello'
		}
	],
	flags: [
		{
			name: 'message',
			alias: 'm',
			type: 'boolean',
			help: 'a boolean argument'
		}
	]
}

const parser = new ArgsAndFlags(options)
const { args, flags } = parser.parse(['hi', '-m'])

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

Help keep this project open and inclusive. Read and follow our Code of Conduct.

Change log

Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Contact

License

ISC

Dependencies (4)

Dev Dependencies (3)

Package Sidebar

Install

npm i args-and-flags

Weekly Downloads

3

Version

3.0.3

License

ISC

Unpacked Size

27 kB

Total Files

12

Last publish

Collaborators

  • sethvincent