[go: up one dir, main page]

parse-help

2.0.0 • Public • Published

parse-help

Parse CLI help output

Install

$ npm install parse-help

Usage

import parseHelp from 'parse-help';

const help = `
	Usage
	  $ unicorn <name>

	Options
	  --rainbow    Lorem ipsum dolor sit amet
	  -m, --magic  Aenean commodo ligula eget dolor
	  --pony       Nullam dictum felis eu pede
	  -c, --color  Donec quam felis

	Examples
	  $ unicorn Peachy
	  $ unicorn Sparkle --rainbow --magic
`;

parseHelp(help);
/*
{
	flags: {
		rainbow: {
			description: 'Lorem ipsum dolor sit amet'
		},
		magic: {
			alias: 'm',
			description: 'Aenean commodo ligula eget dolor'
		},
		pony: {
			description: 'Nullam dictum felis eu pede'
		},
		color: {
			alias: 'c',
			description: 'Donec quam felis'
		}
	},
	aliases: {
		m: 'magic',
		c: 'color'
	}
}
*/

Related

  • aliases - Parse flag aliases in CLI help output

Dependents (10)

Package Sidebar

Install

npm i parse-help

Weekly Downloads

213,718

Version

2.0.0

License

MIT

Unpacked Size

3.38 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus