Skip to content

fix: use full argument in NoSuchOption for short options#1

Open
RogueTex wants to merge 1 commit into
mainfrom
fix/short-option-error-message
Open

fix: use full argument in NoSuchOption for short options#1
RogueTex wants to merge 1 commit into
mainfrom
fix/short-option-error-message

Conversation

@RogueTex
Copy link
Copy Markdown
Owner

Summary

Fixes pallets#2779 - when a multi-character short option like -dbgwrong is passed and not found, the error message previously showed only the first character (e.g., No such option: -d) instead of the full argument.

Root cause: _match_short_opt iterated over single characters and raised NoSuchOption(opt) where opt was the single-char option string. The arg parameter (the full original argument) was available but unused in the error.

Fix: Pass arg instead of opt to NoSuchOption, so users see the full string they typed.

Before:

Error: No such option: -d

After:

Error: No such option: -dbgwrong

Closes pallets#2779

Refactor error handling for unknown options in parser.
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.

Wrong error message when wrong multicharacter short option is passed

1 participant