← Back to issue list

Fixed global options behaviour.

View original Github issue

Metadata

Project
charmcraft
Number
#137
Type
pull request
State
merged
Author
facundobatista
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #137 fixes global CLI options being overwritten by argparse subparser defaults in commit 56ce5431, merged via 6487742f.

Resolution: closed resolved

Reason: PR #137 was approved and merged into main as 6487742f. Its change preserves global option values such as --verbose instead of letting subparser defaults overwrite them.

Evaluated by: mr-cal-bot

No scores available.

Issue body

This was broken because argparse overwrites the global parser names with the command's subparser names (so, when you did `charmcraft -v cmd`, it got `.verbose` in False because the command has it in False, even if global was True.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #137 fixes global CLI options being overwritten by argparse subparser defaults in commit 56ce5431, merged via 6487742f.
stealth/space-bunny-alpha — closed resolved Merged PR #137 fixed Charmcraft’s global options so subparsers no longer overwrite global argparse values, including verbosity before commands.
qwen/qwen3.6-35b-a3b — — Merged fix resolving global options behavior broken by argparse overwriting global parser names with subcommand names. Approved by two reviewers, passed CI, and modified 31/7 lines across two files.
qwen3.6-35b-a3b-mtp-q6 — — Merged fix for global options behavior. Argparse incorrectly overwrote global parser names with subparser names, causing flags like -v to evaluate to False. Global options now persist correctly across commands.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#135 (confidence 95%)

    Merged in ac710131 to support global options after commands, directly preceding and motivating this fix.

Related issues

Issue Project State Summary Similarity
#135 Support the global options also after the command is given. charmcraft merged Merged PR #135 (branch replicate-global-options, commit87777145, merge ac710131) lets global CLI options be passed after the subcommand; follow-up #137 refined the behaviour.
73%
#42 Global options must be replicated on each command charmcraft closed Global options now work before or after subcommands. PR #137 completed the fix in commit 56ce5431 and was merged as 6487742f.
70%