Socket
Book a DemoInstallSign in
Socket

help-parser

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

help-parser

parse unix help output to object

1.3.1
latest
Source
npmnpm
Version published
Weekly downloads
12
Maintainers
1
Weekly downloads
 
Created
Source

Help-Parser parse command output

Travis npm package

Help-Parser

parse any unix standard help output (from running -h/--help)

Check it out

Help-Parser

Installing and using

npm install help-parser
const parseHelpOutput = require('help-parser')

const doc =`
Usage:
  node [--statistics] [--count] [--benchmark] PATH...
  node --version

Options:
  -h --help            show this help message and exit
  --version            show version and exit
  -v --verbose         print status messages
  -q --quiet           report only file names
  -r --repeat          show all occurrences of the same error
  --exclude=PATTERNS   exclude files or directories[default: .svn,CVS,.bzr,.hg,.git]

`;

const help = parseHelpOutput(doc, 'node');
console.log(help)

gives

{ cmdName: 'node',
  usage:
   [ 'Usage:',
     'node [--statistics] [--count] [--benchmark] PATH...',
     'node --version' ],
  args:{
     '--help': { alias: '-h', doc: 'show this help message and exit' },
     '--version': { alias: null, doc: 'show version and exit' },
     '--verbose': { alias: '-v', doc: 'print status messages' },
     '--quiet': { alias: '-q', doc: 'report only file names' },
     '--repeat': { alias: '-r', doc: 'show all occurrences of the same error' },
     '--exclude':{
        alias: null,
        doc:
         'exclude files or directories[default: .svn,CVS,.bzr,.hg,.git]'
      }
  }
}

or clone the git repo and help develop and add to this project

Keywords

parse

FAQs

Package last updated on 16 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.