Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/argument/mod.ts>validateFlags

๐Ÿ“š Standard module for denops.vim
Latest
function validateFlags
import { validateFlags } from "https://deno.land/x/denops_std@v6.5.1/argument/mod.ts";

Validate if flags has unknown attributes.

import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.1/mod.ts";
import { parse, validateFlags } from "https://deno.land/x/denops_std@v6.5.1/argument/mod.ts";

export const main: Entrypoint = async (denops) => {
  const args = [
    "++enc=sjis",
    "++ff=dos",
    "-f",
    "--foo=foo",
    "--bar=bar",
    "--bar=baz",
    "hello",
    "world",
  ];
  const [_opts, flags, _residues] = parse(args);

  validateFlags(flags, ["f", "foo", "bar"]);
}

Parameters

flags: Flags
knownAttributes: string[]