ease-args

A lightweight command line arguments parser that can be used nested like docker command line.

Usage no npm install needed!

<script type="module">
  import easeArgs from 'https://cdn.skypack.dev/ease-args';
</script>

README

ease-args

A lightweight command line arguments parser that can be used nested like docker command line.

Install

npm install ease-args

Example

code

    const easeArgs = require("ease-args");

    var res = easeArgs(process.argv, {
        "help": { type: Boolean, default: true },
        "set": { type: String, default: "" },
    }, {
        "h": "help",
        "s": "set",
    });
    console.log(`res: ${JSON.stringify(res)}`);

command line

node . --set "hello-world" "hello-world" "I am test."

output

res: {"route":"/","options":{"set":"hello-world"},"content":["hello-world","I am test."]}