function parse
parse(
projectRoot: string,
argv?: readonly string[],
cwd?: string
): Result<ParsedFlags, ParseFailure>

Parses an argv into a qunitx flag object (inputs, debug, watch, failFast, timeout, output, port, before, after).

argv and cwd default to the live process, which is the CLI's call. They are parameters rather than reads so the daemon and the JS API can parse someone else's invocation without borrowing process globals to do it.

import * as Args from './index.ts';

const parsed = Args.parse('/proj', ['--timeout=5000'], '/proj');
Args.InvalidFlag.is(parsed) ? parsed.code : parsed.timeout; // 5000

Parameters

projectRoot: string
optional
argv: readonly string[]
optional
cwd: string

Return Type

Usage

import { parse } from "lib/args/parse.ts";