aliases

2.0.0 • Public • Published

aliases

Parse flag aliases in CLI help output

Install

$ npm install aliases

Usage

import aliases from '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 minimist alias option or used in meow with some effort.

API

aliases(input, extras?)

input

Type: string

CLI help output.

extras

Type: object

Extra aliases to mix into the result.

Related

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    16
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    16
  • 1.0.0
    5
  • 0.1.0
    13

Package Sidebar

Install

npm i aliases

Weekly Downloads

34

Version

2.0.0

License

MIT

Unpacked Size

2.8 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus