日本語のREADMEはこちらです: README.ja.md
A minimalist argument parser.
- Parses argument options
- Supports boolean, string, and numeric options
- Supports aliases for options
- Handles options with and without equal signs
- Stops parsing after
--option
import parse from "https://code4fukui.github.io/minimist/index.js";
const argv = parse(Deno.args);
console.log(argv);$ deno run example/parse.js -a beep -b boop
{ _: [], a: "beep", b: "boop" }
$ deno run example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{
_: [ "foo", "bar", "baz" ],
x: 3,
y: 4,
n: 5,
a: true,
b: true,
c: true,
beep: "boop"
}
import parseArgs from "https://code4fukui.github.io/minimist/index.js";Return an argument object argv populated with the array arguments from args.
Options can include:
opts.string- arguments to always treat as stringsopts.boolean- arguments to always treat as booleansopts.alias- object mapping argument names to aliasesopts.default- default values for argumentsopts.stopEarly- stop parsing on the first non-optionopts['--']- treat everything after--as positional arguments
MIT License — see LICENSE.