Skip to content

pantoken / packages/cli/src / parseArgs

Function: parseArgs()

parseArgs(argv): CliArgs

Beta

Parse generate <target> [--out dir] [--theme t] [--class Name].

Parameters

argv

readonly string[]

Returns

CliArgs

Examples

Positional target plus value flags

ts
import { parseArgs } from "@pantoken/cli";

parseArgs(["generate", "swift", "--out", "./ios", "--theme", "canvas"]);
// → { command: "generate", target: "swift", out: "./ios", theme: "canvas",
//     className: "PanTokens", … }

Boolean flags and a comma-separated --icons list

ts
import { parseArgs } from "@pantoken/cli";

const args = parseArgs(["generate", "pendo", "--no-scope", "--icons", "arrow-left,check-mark"]);
args.noScope; // → true
args.icons;   // → ["arrow-left", "check-mark"]