You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@hugoalh/command-line-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@hugoalh/command-line-parser

A module to parse command line with better standard.

0.12.1
unpublished
pre
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Command Line Parser (NodeJS Edition)

CommandLineParser.NodeJS - A NodeJS module to parse command line with better standard.

GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade LGTM Alerts LGTM Grade License

ReleaseLatestPre
GitHub GitHub Total DownloadsGitHub Latest Release Version (GitHub Latest Release Date)GitHub Latest Pre-Release Version (GitHub Latest Pre-Release Date)
NPM NPM Total DownloadsNPM Latest Release VersionNPM Latest Pre-Release Version

📝 Description

For Deno edition, please visit here.

🌟 Feature

  • Easier to remember which is flag and which is option (i.e.: key-value pair).
  • Native support for CommonJS and ModuleJS.

📚 Documentation

Getting Started

NodeJS (>= v14.15.0) & NPM (>= v6.14.8):

npm install @hugoalh/command-line-parser

API

(commandLine?)

Description

Parse command line.

Argument

commandLine?

<string[] = process.argv.slice(2)> Command line that need to parse.

Return

<object> Parse result.

  • action: <string[]>
  • fault: <string[]> Unparseable argument.
  • flag: <string[]> Flag.
  • option: <object> Key-value pair.

Example

const commandLineParser = require("@hugoalh/command-line-parser");

console.log(commandLineParser(["-test", "--message=\"Hello, world!\"", "lol", "---fail"]));
/*
{
  action: [
    "lol"
  ],
  fault: [
    "---fail"
  ],
  flag: [
    "test"
  ],
  option: {
    message: "Hello, world!"
  }
}
*/

Keywords

argument

FAQs

Package last updated on 04 Aug 2021

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