node package manager

aliases

aliases Build Status

Parse flag aliases in CLI help output

Install

$ npm install --save aliases

Usage

const aliases = require('aliases');
 
const help = `
    Usage
      $ unicorn <name>
 
    Options
      -r, --rainbow  Lorem ipsum dolor sit amet
      -m, --magic    Aenean commodo ligula eget dolor
`;
 
aliases(help, {h: 'help'});
/*
{
    r: 'rainbow',
    m: 'magic',
    h: 'help'
}
*/

The result can be passed directly to the meow or minimist alias option.

API

aliases(input, [extras])

input

Type: string

CLI help output.

extras

Type: object

Extra aliases to mix into the result.

Related

License

MIT © Sindre Sorhus