tokenize
Tokenize raw argv into structured tokens.
Low-level utility: most apps should use parse, cli().run(), or runCommand() instead of tokenizing manually. Reach for tokenize() when building custom tooling such as debuggers, inspectors, or parser tests.
Rules:
--→ separator (everything after is positional)--flag→ long flag, no inline value--flag=v→ long flag with inline value-abc→ short flags (expanded individually by parser)-→ positional (convention: stdin placeholder)everything else → positional
Import:
@kjanat/dreamcliExport kind: function
Declared in:
src/core/parse/index.tsSource link:
src/core/parse/index.ts:90
Signatures
function tokenize(argv: readonly string[]): readonly Token[];| Parameter | Type | Description |
|---|---|---|
argv | readonly string[] | Raw argument strings to tokenize |
Members
Members
tokenize
Tokenize raw argv into structured tokens.
Low-level utility: most apps should use parse, cli().run(), or runCommand() instead of tokenizing manually. Reach for tokenize() when building custom tooling such as debuggers, inspectors, or parser tests.
Rules:
--→ separator (everything after is positional)--flag→ long flag, no inline value--flag=v→ long flag with inline value-abc→ short flags (expanded individually by parser)-→ positional (convention: stdin placeholder)- everything else → positional
(argv: readonly string[]): readonly Token[];Examples
tokenize(['deploy', '--force', '--region=eu', '-v']);