Open this example in the interactive library
Source code
import { parseArgs } from "node:util";
console.log(
parseArgs({
args: ["--ok", "job"],
options: { ok: { type: "boolean" } },
allowPositionals: true,
tokens: true,
}).tokens.map((t) => t.kind),
);
Sample output
[ 'option', 'positional' ]
