Skip to content

pantoken / packages/cli/src / parseArgs

函式: parseArgs()

parseArgs(argv): CliArgs

Beta(測試)

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

參數

argv

readonly string[]

回傳

CliArgs

範例

位置目標及值旗標

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

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

布林旗標與逗號分隔的 --icons 清單

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"]