Skip to content

h4ndy-on-github/minimist-options

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimist-options Build Status

Write options for minimist in a comfortable way.

Installation

$ npm install --save minimist-options

Usage

const buildOptions = require('minimist-options');
const minimist = require('minimist');

const options = buildOptions({
	name: {
		type: 'string',
		alias: 'n',
		default: 'john'
	},

	force: {
		type: 'boolean',
		alias: ['f', 'o'],
		default: false
	},

	published: 'boolean',

	// special option for positional arguments (`_` in minimist)
	arguments: 'string'
});

const args = minimist(options);

instead of:

const minimist = require('minimist');

const options = {
	string: ['name', '_'],
	boolean: ['force', 'published'],
	alias: {
		n: 'name',
		f: 'force',
		o: 'force'
	},
	default: {
		name: 'john',
		f: false
	}
};

const args = minimist(options);

License

MIT © Vadim Demedes

About

Clean and beautiful options for minimist

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%