Registry / devops / parse-help

parse-help

JSON →
library2.0.0jsnpmunverified

parse-help is a JavaScript utility for programmatically parsing the help output of command-line interfaces, extracting structured information about their flags, options, and aliases. It provides a structured object representation of CLI options, making it easier to analyze or process them within other tools. The current stable version is 2.0.0. The package is maintained by Sindre Sorhus, known for a high volume of small, focused utility packages, typically implying a stable but not necessarily rapid release cadence unless new features or breaking changes warrant it. A key differentiator is its focus specifically on parsing *help output* rather than building a CLI from scratch or parsing `argv` directly, making it useful for introspection or documentation generation from existing CLIs.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Since v2.0.0, parse-help is a pure ESM module and must be imported using ES modules syntax. CommonJS `require()` is no longer supported.

import parseHelp from 'parse-help';

Demonstrates how to import and use `parseHelp` to process a sample CLI help string and output the structured flags and aliases.

import parseHelp from 'parse-help'; const helpOutput = ` Usage $ my-cli <command> [options] Options -v, --verbose Enable verbose logging --config <path> Specify a configuration file (default: config.json) -h, --help Show help information Examples $ my-cli start $ my-cli build --config custom.json `; const parsed = parseHelp(helpOutput); console.log('Parsed Flags:', JSON.stringify(parsed.flags, null, 2)); console.log('Parsed Aliases:', JSON.stringify(parsed.aliases, null, 2)); /* Output would be: Parsed Flags: { "verbose": { "alias": "v", "description": "Enable verbose logging" }, "config": { "description": "Specify a configuration file (default: config.json)" }, "help": { "alias": "h", "description": "Show help information" } } Parsed Aliases: { "v": "verbose", "h": "help" } */
Debug
Known footguns
breakingparse-help v2.0.0 is a pure ESM module. It no longer supports CommonJS `require()` and must be used with `import` statements in an ESM environment.
breakingNode.js 12 or newer is now required for parse-help v2.0.0. Older Node.js versions are not supported.
gotchaThe package specifically parses 'help output' as a string. It does not execute a CLI or interact with `process.argv` directly. The quality and format of the output heavily depend on the consistency and standard adherence of the input help string.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources