Skip to main content
Module

x/udd/deps.ts>parseArgs

Update Deno Dependencies - update dependency urls to their latest published versions
Very Popular
Latest
function parseArgs
import { parseArgs } from "https://deno.land/x/udd@0.8.2/deps.ts";

Take a set of command line arguments, optionally with a set of options, and return an object representing the flags found in the passed arguments.

By default, any arguments starting with - or -- are considered boolean flags. If the argument name is followed by an equal sign (=) it is considered a key-value pair. Any arguments which could not be parsed are available in the _ property of the returned object.

import { parse } from "https://deno.land/std@0.223.0/flags/mod.ts";
const parsedArgs = parse(Deno.args);
import { parse } from "https://deno.land/std@0.223.0/flags/mod.ts";
const parsedArgs = parse(["--foo", "--bar=baz", "./quux.txt"]);
// parsedArgs: { foo: true, bar: "baz", _: ["./quux.txt"] }

Type Parameters

V extends Values<B, S, C, N, D, A>
optional
DD extends boolean | undefined = undefined
optional
B extends BooleanType = undefined
optional
S extends StringType = undefined
optional
C extends Collectable = undefined
optional
N extends Negatable = undefined
optional
D extends Record<string, unknown> | undefined = undefined
optional
A extends Aliases<AK, AV> | undefined = undefined
optional
AK extends string = string
optional
AV extends string = string

Parameters

args: string[]
optional
unnamed 1: ParseOptions<B, S, C, N, D, A, DD> = [UNSUPPORTED]

Returns

Args<V, DD>