@hugoalh/cli-argument-parserdeprecated

A module/library and CLI tool to parse CLI argument with hugoalh Studio standard.

Usage no npm install needed!

<script type="module">
  import hugoalhCliArgumentParser from 'https://cdn.skypack.dev/@hugoalh/cli-argument-parser';
</script>

README

Command Line Parser (NodeJS Edition)

CommandLineParser.NodeJS GitHub Language Count GitHub Top Langauge GitHub Repo Size GitHub Code Size GitHub Watcher GitHub Star GitHub Fork

A NodeJS module to parse command line with better standard.

License MIT
Release (GitHub) Latest: ()
Pre: ()
Release (NPM) Latest:
Pre:
Contributor
Issue :
Pull Request :
Code Quality CodeFactor Grade LGTM Alert LGTM Grade

📜 Description

🌟 Feature

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

📄 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[] = []> 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!"
  }
}
*/