feat(parser): improve choice validation and completion for flagged arguments
- Added `_check_if_in_choices()` to enforce `choices` validation for all nargs modes, including after resolver-based and list-based inputs. - Enhanced `FalyxCompleter` to quote multi-word completions for better UX. - Improved completion filtering logic to suppress stale suggestions when flag values are already consumed. - Moved `ArgumentState` and `TLDRExample` to `parser_types.py` for reuse. - Bumped version to 0.1.72.
This commit is contained in:
@@ -90,7 +90,14 @@ class FalyxCompleter(Completer):
|
||||
)
|
||||
for suggestion in suggestions:
|
||||
if suggestion.startswith(stub):
|
||||
yield Completion(suggestion, start_position=-len(stub))
|
||||
if len(suggestion.split()) > 1:
|
||||
yield Completion(
|
||||
f'"{suggestion}"',
|
||||
start_position=-len(stub),
|
||||
display=suggestion,
|
||||
)
|
||||
else:
|
||||
yield Completion(suggestion, start_position=-len(stub))
|
||||
except Exception:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user