import { parseFlags } from "https://deno.land/x/lume@v2.4.1/deps/cliffy.ts";
Parse command line arguments.
Type Parameters
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
}