siokas / denomander

Deno command-line interfaces made easy

Home Page:https://doc.deno.land/https/deno.land/x/denomander/docs.ts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

addOption isRequired/choices not working

martin-braun opened this issue · comments

program
  .command("open", "Opens a foo.")
  .addOption(
    new Option({
      flags: "-f --foo",
      description: "Open something",
      isRequired: true,
      choices: ["a", "b", "c"],
    })
  )
  .action(async () => {
	  console.log(program.foo);
  });

Testing:

> ./my-test.ts open
undefined
> ./my-test.ts open -f d
d

In both cases it should complain that either -f is missing or d is not a valid choice. This doesn't work.