import { parseArgs } from "https://deno.land/x/ayonli_jsext@v0.9.72/workerd/cli.ts";
Parses the given CLI arguments into an object.
Examples
Example 1
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
optional
options: ParseOptions = [UNSUPPORTED]