fix: use full argument in NoSuchOption for short options#3232
Closed
RogueTex wants to merge 1 commit intopallets:mainfrom
Closed
fix: use full argument in NoSuchOption for short options#3232RogueTex wants to merge 1 commit intopallets:mainfrom
RogueTex wants to merge 1 commit intopallets:mainfrom
Conversation
Refactor error handling for unknown options in parser.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2779 - when a multi-character short option like
-dbgwrongis 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_optiterated over single characters and raisedNoSuchOption(opt)whereoptwas the single-char option string. Theargparameter (the full original argument) was available but unused in the error.Fix: Pass
arginstead ofopttoNoSuchOption, so users see the full string they typed.Before:
After:
Closes #2779