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

x/wasmbuild/lib/deps.ts>parseFlags

Build tool to use Rust code in Deno and the browser.
Very Popular
Go to Latest
function parseFlags
import { parseFlags } from "https://deno.land/x/wasmbuild@0.14.1/lib/deps.ts";

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.

import { parse } from "./mod.ts";
const parsedArgs = parse(Deno.args);
import { parse } from "./mod.ts";
const parsedArgs = parse(["--foo", "--bar=baz", "--no-qux", "./quux.txt"]);
// parsedArgs: { foo: true, bar: "baz", qux: false, _: ["./quux.txt"] }

Parameters

args: string[]
optional
unnamed 1: ParseOptions = [UNSUPPORTED]