/** The value returned from `parse`. */ export declare interface Args { /** Contains all the arguments that didn't have an option associated with * them. */ _: Array; [key: string]: any; } /** 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. * * ```ts * import { parse } from "./mod.ts"; * const parsedArgs = parse(Deno.args); * ``` * * ```ts * import { parse } from "./mod.ts"; * const parsedArgs = parse(["--foo", "--bar=baz", "--no-qux", "./quux.txt"]); * // parsedArgs: { foo: true, bar: "baz", qux: false, _: ["./quux.txt"] } * ``` */ export declare function parse(args: string[], { "--": doubleDash, alias, boolean, default: defaults, stopEarly, string, unknown, }?: ParseOptions): Args; /** The options for the `parse` call. */ export declare interface ParseOptions { /** When `true`, populate the result `_` with everything before the `--` and * the result `['--']` with everything after the `--`. Here's an example: * * ```ts * // $ 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`. */ "--"?: boolean; /** An object mapping string names to strings or arrays of string argument * names to use as aliases. */ alias?: Record; /** 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`) */ boolean?: boolean | string | string[]; /** An object mapping string argument names to default values. */ default?: Record; /** When `true`, populate the result `_` with everything after the first * non-option. */ stopEarly?: boolean; /** A string or array of strings argument names to always treat as strings. */ string?: string | string[]; /** 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`. */ unknown?: (arg: string, key?: string, value?: unknown) => unknown; } export { }