Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lume/deps/cliffy.ts>parseFlags

🔥 Static site generator for Deno 🦕
Very Popular
Go to Latest
function parseFlags
Re-export
import { parseFlags } from "https://deno.land/x/lume@v1.18.4/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
}