Skip to main content
Module

x/cliffy/flags/mod.ts>parseFlags

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
function parseFlags
import { parseFlags } from "https://deno.land/x/cliffy@v0.25.2/flags/mod.ts";

Parse command line arguments.

Type Parameters

TFlags extends Record<string, unknown>
TFlagOptions extends IFlagOptions
TFlagsResult extends IFlagsResult

Parameters

argsOrCtx: string[] | TFlagsResult

Command line arguments e.g: Deno.args or parse context.

optional
opts: IParseOptions<TFlagOptions> = [UNSUPPORTED]

Parse options.

// example.ts -x 3 -y.z -n5 -abc --beep=boop foo bar baz --deno.land -- --cliffy
parseFlags(Deno.args);
{
flags: {
x: "3",
y: { z: true },
n: "5",
a: true,
b: true,
c: true,
beep: "boop",
deno: { land: true }
},
unknown: [ "foo", "bar", "baz" ],
literal: [ "--cliffy" ]
}