bossy

Command line options parser.

Latest Version: 6.0.1
hapi-family
Installation:

npm: npm install @hapi/bossy

yarn: yarn add @hapi/bossy

Module Status:
Version License Node Dependencies CI
BSD 16, 18, 20, 22 Dependency Status Build Status
BSD 16, 18, 20, 22 Dependency Status Build Status

Usage

const Bossy = require('@hapi/bossy');
const definition = {
 h: {
 description: 'Show help',
 alias: 'help',
 type: 'boolean'
 },
 n: {
 description: 'Show your name',
 alias: 'name'
 }
};
const args = Bossy.parse(definition);
if (args instanceof Error) {
 console.error(args.message);
 return;
}
if (args.h || !args.n) {
 console.log(Bossy.usage(definition, 'hello -n <name>'));
 return;
}
console.log('Hello ' + args.n);
console.log('Hello ' + args.name);

AltStyle によって変換されたページ (->オリジナル) /