-
Notifications
You must be signed in to change notification settings - Fork 391
feat(_comp_compgen_split): use _comp_compgen_split
for -W '$(...)'
#989
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 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 some comments, those tests added, and conflicts resolved.
BTW this exposed quite a few unaddressed cases more where we are incorrectly using a hardcoded command name instead of the one being invoked, and missing $PATH
prepends. I'll look into them sometime later when this is in.
I'm not sure if it's the intent here, but if this would be in the merge commit, I'm not sure if it would automatically close the referenced issue. https://github.blog/2013-01-22-closing-issues-via-commit-messages/ has some related info on the recognized words, but that's a bit dated. I've usually used |
The current version of the list of keywords are described in Linking a pull request to an issue using a keyword - GitHub Docs, which includes When I'm unsure about whether the issue is really linked, I hover the mouse pointer over the keyword to see if it shows a tooltip. In this case, it seems to show one: |
7becdda
to
f9c0804
Compare
deeaec6
to
8bc4c93
Compare
The option `-X arg` for `compgen` is specified twice, but only the latter takes effect. Also, `-X kernel` excludes the word `kernel` but the latter `-X '!*.ko'` also excludes the word `kernel` because it only leaves the words matches the pattern `*.ko`. Thus, we can just filter the words by `-X '!*.ko'`.
8bc4c93
to
0e84bfa
Compare
Co-authored-by: Ville Skyttä <[email protected]>
Co-authored-by: Ville Skyttä <[email protected]>
0e84bfa
to
f488f96
Compare
Resolve #958
This PR introduces a new generator
_comp_compgen_split
that splits the argument to generate words. The difference from the builtincompgen -W
is that it is safe to pass command outputs to the argument because it doesn't evaluate the expansions in the argument. It was still possible with passing the command substitution with single quotes ascompgen -W '$(command)'
, but it requires excessive quoting and also is incompatible with_comp_compgen
when the command contains positional parameters such as$1
. In addition, the inside of the single-quoted command substitutions'$(...)'
is not checked byshellcheck
.This is still a draft because I think I need to add tests for the new function
_comp_compgen_split
.