Skip to content

docs: fix parameter names showing as None in CLI usage docs - #2671

Draft
lengau with Copilot wants to merge 2 commits into
mainfrom
copilot/monitor-ci-runs
Draft

docs: fix parameter names showing as None in CLI usage docs#2671
lengau with Copilot wants to merge 2 commits into
mainfrom
copilot/monitor-ci-runs

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Other CI failures found on main (documented below, no simple fix in charmcraft):

  • snap-store-tests failing: Charmhub credentials expired (infrastructure issue)
  • snap-tests (ubuntu-22.04/20.04): smoketests/different-dir-metadata fails due to craft_providers snapd initialization issue (upstream issue in craft_providers; see PR Investigation: Spread test failures are due to craft_providers snapd initialization issue #2509)
  • snap-tests (ubuntu-26.04): Transient apt package unavailability on Ubuntu devel daily builds (gcc and python3-dev not found) — not fixable in charmcraft
  • Spread tests have been failing consistently since at least March 2026 (all due to upstream issues)

Required arguments with no explicit metavar were displaying as <None>
in the generated command reference docs. Fix by falling back to the
argparse convention: positional args use dest, optional args use
dest.upper().

Fixes #2578
Fixes #2642

Agent-Logs-Url: https://github.com/canonical/charmcraft/sessions/214f19c4-3b9e-4123-9e2d-d2fc75b2ca6d

Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the CLI docs generator so required argument placeholders no longer render as <None> when an argparse action doesn’t explicitly define metavar, aligning the generated “Usage” string with argparse’s default metavar conventions.

Changes:

  • Add a fallback metavar computation for required actions when action.metavar is unset.
  • Use dest for positionals and dest.upper() for optionals to match argparse defaults.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: The usage parameters show up as None

3 participants