Skip to content

fix(cli): reject options add_renamed_argument cannot alias - #24

Merged
MrKevinWeiss merged 1 commit into
masterfrom
fix/renamed-argument-unsupported
Sep 30, 2026
Merged

MrKevinWeiss merged 1 commit into
masterfrom
fix/renamed-argument-unsupported

Conversation

@MrKevinWeiss

Copy link
Copy Markdown
Collaborator

add_renamed_argument silently misbehaved for two kinds of options:

  • required=True: argparse checks required-ness per spelling, so --loglevel DEBUG still fails with the following arguments are required: --log-level.
  • action="append" / "count" (and anything but the store actions): DeprecatedAliasAction overwrites the value, so --x a --y b gives 'b' and -v --verb gives None.

Both now raise ValueError when the option is added. I grepped every caller in ~/repos/lobaro/ (lob-cord, lob-fqf, lob-nrf-sx-gw4, lob-at); none passes required or an action other than store_true, so nothing breaks.

New parametrised test fails on master for all three cases.

🤖 Generated with Claude Code

With required=True argparse checks each spelling separately, so the
deprecated one could never satisfy the requirement. append and count
build on the previous value, which DeprecatedAliasAction overwrites,
so `--x a --y b` kept only b and `-v --verb` gave None. Raise a
ValueError when such an option is added instead of misparsing later.
No current caller uses either.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@MrKevinWeiss
MrKevinWeiss merged commit c1e69dd into master Sep 30, 2026
6 checks passed
@MrKevinWeiss
MrKevinWeiss deleted the fix/renamed-argument-unsupported branch September 30, 2026 09:39
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.

1 participant