Skip to content

usage errors list --api-url in the Usage line when the environment sets it #201

Closed

Description

Measured

Version 0.5.0, Windows, PowerShell:

> $env:HODEISHIELD_API_URL='http://127.0.0.1:9'; hodeishield vendors get
error: the following required arguments were not provided:
  <ID>
Usage: hodeishield.exe vendors get --api-url <URL> <ID>

--api-url is optional; clap lists it because the option is bound to an environment variable that is set.

Why it matters

The Usage line suggests a required option that the person never has to type.

Acceptance criteria

  • The Usage line of a usage error does not list --api-url when only the environment sets it.

Activity

  1. d0ubl3g commented on Oct 17, 2026

    @d0ubl3g
    ContributorAuthor

    Not fixed in this pass: clap marks any argument bound to an environment variable as present when the variable is set, so it appears in the Usage line. Avoiding it means dropping env from --api-url and --profile and reading the variables by hand, which also changes how --help shows them. Left open.

  2. d0ubl3g commented on Oct 19, 2026

    @d0ubl3g
    ContributorAuthor

    Fixed in v0.5.1 (#204). --api-url and --profile no longer appear in the Usage: line of a usage error when only HODEISHIELD_API_URL or HODEISHIELD_PROFILE sets them. The variables work as before, an explicit flag still takes precedence, and --help still names them. A regression test covers it (usage_line_does_not_list_options_set_by_the_environment). The earlier comment saying this was not fixed no longer applies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingux-designDesign or user experience

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions