Package Exports
- @tcbox/command-parser
- @tcbox/command-parser/command-parser.cjs.min.js
- @tcbox/command-parser/command-parser.es.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tcbox/command-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Command Parser
Parse Command line and process.argv.
Usage
npm install command-parserparseCommand
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>