-
Notifications
You must be signed in to change notification settings - Fork 391
fix(mdtool,rcs,etc): fix uses of -G 'pat'
and -f -X '!pat'
#1358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There is still an issue with One of the reasons that some of the completion setting use
|
-G 'pat'
and -f -X '!pat'
-G 'pat'
and -f -X '!pat'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 7 changed files in this pull request and generated no comments.
Files not reviewed (6)
- completions/feh: Language not supported
- completions/mdtool: Language not supported
- completions/rcs: Language not supported
- completions/upgradepkg: Language not supported
- completions/valgrind: Language not supported
- test/runLint: Language not supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-approved with a couple of cosmetic notes, ok to merge whether addressed or not.
In the current implementation, when the current word contains any glob characters, the glob pattern can match unexpected files. We instead use `_comp_expand_glob` with double-quoting the strings originating from the current word.
The original code (which is commented out and marked as TODO) tried to perform the filename generation by specifying both `-f` and `-G`, and also specifying `-G` multiple times. This has the following issues: * The completion specification of `-f` and `-G` are independent, so this code is going to generate all filenames with `-f`. Then, it additionally generates the filenames matching the specified pattern. * The `-G pat` can only be specified once, or the latter `-G pat` specification will overwrite the previous specification. We should combine multiple patterns into one. Note: This code stub was originally introduced in commit 73225ea. In this patch, we remove `-f` and merge multiple `-G`.
scop#1297 (comment) The compgen option `-X '!pat'` has a problem that it only generates the filenames in the current directory and that it does not perform the filtering by the "cur" specified to the argument of `compgen`: $ compgen -G '*.md' -- doc/ CHANGELOG.md CONTRIBUTING.md README.md style.md In this patch, we use `-f -X '!pat'`, which does not have those limitations.
e98f1a7
to
72f745f
Compare
This PR addresses issues discussed in #1297. This PR also includes other changes. See the commit messages.
_comp_compgen -C
#1297 (comment)_comp_compgen -C
#1297 (comment)