0.0.2 • Published 5 months ago

@tcbox/command-parser v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Command Parser

Parse Command line and process.argv.

Demo

Usage

npm install command-parser

parseCommand

import {parseCommand} from "command-parser";
const commands = parseCommand(`
    node index.js -D |
    npm install
`);

result is

[
  {
    "name": "node",
    "args": [
      "index.js"
    ],
    "options": {
      "D": true
    }
  },
  {
    "name": "npm",
    "args": [
      "install"
    ],
    "options": {}
  }
]

parseArgv

This is only for nodejs

import {parseArgv} from "command-parser";
const command = parseArgv();

CDN

<script src="https://cdn.jsdelivr.net/npm/command-parser"></script>
<script>console.log(window.CommandParser) </script>
0.0.2

5 months ago

0.0.1

5 months ago