fix: correct issues with !
extglobs and compgen -X
#317
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.
Fixes multiple issues with extglob pattern matching support, particularly with
!(...)
patterns. Additional changes for use of patterns as filter expressions in completion (notably, fixes to inversion).Updates to pattern parsing:
brush-parser/src/pattern.rs
: Refactored theextended_glob_body
rule to simplify the parsing of extended glob patterns and adjusted how negative lookaheads are handled in the regex generation. [1] [2] [3]Addition of test cases:
brush-core/src/patterns.rs
: Added extensive test cases to verify the behavior of pattern matching with and without extended globbing, covering various scenarios including basic, advanced, and degenerate cases.brush-shell/tests/cases/builtins/compgen.yaml
: Added new test cases for thecompgen
command with extended globbing enabled.brush-shell/tests/cases/patterns.yaml
: Added new test cases for pathname expansion with extended globbing, including degenerate inverted patterns. [1] [2]Other changes:
brush-shell/tests/completion_tests.rs
: Adjusted the expected results in thecomplete_path_args_to_well_known_programs
test to reflect the updated completion logic.