import { parse } from "https://deno.land/x/denops_std@v6.2.0/argument/mod.ts";
Parse string array to extract opts, flags.
import type { Denops } from "https://deno.land/x/denops_std@v6.2.0/mod.ts";
import { parse } from "https://deno.land/x/denops_std@v6.2.0/argument/mod.ts";
export async function main(denops: Denops): Promise<void> {
const args = [
"++enc=sjis",
"++ff=dos",
"-f",
"--foo=foo",
"--bar=bar",
"--bar=baz",
"hello",
"world",
];
const [opts, flags, residues] = parse(args);
console.log(opts);
// { "enc": "sjis", "ff": "dos" }
console.log(flags);
// { "f": "", "foo": "foo", "bar": ["bar", "baz"] }
console.log(residues);
// ["hello", "world"]
}