Go to Latest
interface ArgParsingOptions
import { type ArgParsingOptions } from "https://dotland.deno.dev/std@0.110.0/flags/mod.ts";

Properties

optional
--: boolean

When true, populate the result _ with everything before the -- and the result ['--'] with everything after the --. Here's an example:

     // $ deno run example.ts -- a arg1
     import { parse } from "./mod.ts";
     console.dir(parse(Deno.args, { "--": false }));
     // output: { _: [ "a", "arg1" ] }
     console.dir(parse(Deno.args, { "--": true }));
     // output: { _: [], --: [ "a", "arg1" ] }

Defaults to false.

optional
alias: Record<string, string | string[]>

An object mapping string names to strings or arrays of string argument names to use as aliases

optional
boolean: boolean | string | string[]

A boolean, string or array of strings to always treat as booleans. If true will treat all double hyphenated arguments without equal signs as boolean (e.g. affects --foo, not -f or --foo=bar)

optional
default: Record<string, unknown>

An object mapping string argument names to default values.

optional
stopEarly: boolean

When true, populate the result _ with everything after the first non-option.

optional
string: string | string[]

A string or array of strings argument names to always treat as strings.

optional
unknown: (
arg: string,
key?: string,
value?: unknown,
) => unknown

A function which is invoked with a command line parameter not defined in the options configuration object. If the function returns false, the unknown option is not added to parsedArgs.