Module

x/lume/deps/cliffy.ts>parseFlags

🔥 Static site generator for Deno 🦕
Very Popular
Latest
function parseFlags
import { parseFlags } from "https://dotland.deno.dev/x/lume@v2.4.2/deps/cliffy.ts";

Parse command line arguments.

Type Parameters

TFlags extends Record<string, unknown>
TFlagOptions extends FlagOptions
TFlagsResult extends ParseFlagsContext

Parameters

argsOrCtx: string[] | TFlagsResult

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

optional
opts: ParseFlagsOptions<TFlagOptions> = [UNSUPPORTED]

Parse options.

// examples/flags/flags.ts -x 3 -y.z -n5 -abc --beep=boop foo bar baz --deno.land --deno.com -- --cliffy
parseFlags(Deno.args);

Output:

{
flags: {
x: "3",
y: { z: true },
n: "5",
a: true,
b: true,
c: true,
beep: "boop",
deno: { land: true, com: true }
},
literal: [ "--cliffy" ],
unknown: [ "foo", "bar", "baz" ],
stopEarly: false,
stopOnUnknown: false
}
import parseFlags
import { parseFlags } from "https://dotland.deno.dev/x/lume@v2.4.2/deps/cliffy.ts";