Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-argv-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-argv-parser

A library that allows to parse command line arguments into hash-table or object by scheme

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Command Line Argumets Parser

A library that allows to parse command line arguments into hash-table or object by scheme.

Installation

Install library to your project:

$ npm install cli-argv-parser

How to use

You able to put only arguments array to parser and it will be return a hash-table (key-value). But if you want to parse arguments into object - use template scheme with keys and required types.

Scheme:

const scheme = {
    file: String,
    force: Boolean,
    count: Number,
}

The template is key: type. Parser will try to convert argument into required type. By default single values will be always parsed into Boolean value.

Example of result:

  • Without scheme: { '--file': 'app.js', force: true, '--count': '20' }
  • With scheme: { file: 'app.js', force: true, count: 20 }

Author

Yehor Bublyk: GitHubTwitter

Keywords

FAQs

Package last updated on 06 Feb 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc