f
tokenize(args: readonly string[]): ArgToken[]
Classifies argv into query / flag / input tokens.
I
FlagToken
Any other flag (--watch, --timeout=5000, -o, …), passed through verbatim.
-
kind: "flag"
Discriminant.
-
raw: string
The exact argv entry, including leading dashes and any
=value.
I
InputToken
A positional target: a file, folder, or glob (possibly with a #34 line suffix).
-
kind: "input"
Discriminant.
-
raw: string
The exact argv entry.
I
QueryToken
A query flag (-t/-m/-s/-p) with its resolved value.
-
action: "run" | "list"
What to do with the matches:
runnarrows which tests execute;listpreviews them instead. -
greedy: boolean
True when the value was consumed from following argv entries (
-t a b) rather than=glued. -
kind: "query"
Discriminant.
-
value: string | null
The value, or null when the flag was given with nothing after it.
T
ArgToken = QueryToken | FlagToken | InputToken
One classified argv entry: a query flag, any other flag, or a positional input.
Usage
import * as mod from "lib/args/tokenize.ts";