deno-cliffy icon indicating copy to clipboard operation
deno-cliffy copied to clipboard

Error message "Missing required environment variable" is displayed with help command

Open ytkg opened this issue 2 years ago • 0 comments

Hi!

Error message "Missing required environment variable" is displayed with help command. Is this intentional?

import { Command } from "https://deno.land/x/[email protected]/command/mod.ts";

await new Command()
  .name("sample-cli")
  .version("0.0.1")
  .env("FOO=<value:string>", "FOO", { required: true })
  .parse(Deno.args);
$ deno run cli.ts -h

  Usage:   sample-cli
  Version: 0.0.1

  Options:

    -h, --help     - Show this help.
    -V, --version  - Show the version number for this program.

  Environment variables:

    FOO  <value>  - FOO

  error: Missing required environment variable "FOO".

Ideally, the help command should not display this error message.

when option, error message is not displayed.

import { Command } from "https://deno.land/x/[email protected]/command/mod.ts";

await new Command()
  .name("sample-cli")
  .version("0.0.1")
  .option("--foo <foo:string>", "foo", { required: true })
  .parse(Deno.args);
$ deno run cli.ts -h

  Usage:   sample-cli
  Version: 0.0.1

  Options:

    -h, --help            - Show this help.
    -V, --version         - Show the version number for this program.
    --foo          <foo>  - foo                                        (required)

ytkg avatar Jun 27 '22 16:06 ytkg