Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/workerd/cli.js>parseArgs

A JavaScript extension package for building strong and modern applications.
Latest
function parseArgs
import { parseArgs } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/workerd/cli.js";

Parses the given CLI arguments into an object.

Examples

Example 1

import { parseArgs } from "@ayonli/jsext/cli";

const args = parseArgs([
    "Bob",
    "--age", "30",
    "--married",
    "--wife=Alice",
    "--children", "Mia",
    "--children", "Ava",
    "-p"
], {
    alias: { "p": "has-parents" },
    lists: ["children"],
});

console.log(args);
// {
//     "0": "Bob",
//     age: 30,
//     married: true,
//     wife: "Alice",
//     children: ["Mia", "Ava"],
//     "has-parents": true
// }

Parameters

args
optional
options = [UNSUPPORTED]