-
Notifications
You must be signed in to change notification settings - Fork 390
refactor(bash_completion): refactor { => _comp_}{dequote,quote}
#736
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
d98dce8
to
59c4b8f
Compare
9b4b037
to
74cf5f1
Compare
8c3ae04
to
45233e8
Compare
5ce7ee6
to
1cd1d67
Compare
Also, it should be noted that, in these commits, I have changed the interface of Another thing that needs to be discussed is the annotations like |
3f49e1b
to
16a0124
Compare
dequote
as _comp_dequote
{ => _comp_}{dequote,quote}
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.
LGTM, thanks! Left a few trivial comments, feel free to merge after addressing.
I have decided to further change the variable names as |
Hmm, in that case I wonder if the syntax we use in the variables' values here throw off shellcheck's parser. That would be unfortunate as we probably wouldn't be able to rely on it much in the file after the position of the definitions. |
I think the problem is not that $ cat test.sh
#!/usr/bin/env bash
function setv { eval "$1=\$2"; }
function func1 { local var="'"; }
function func2 { local var; setv var 1; echo $var; }
$ shellcheck test.sh
In test.sh line 3:
function func1 { local var="'"; }
^-- SC2089: Quotes/backslashes will be treated literally. Use an array.
In test.sh line 4:
function func2 { local var; setv var 1; echo $var; }
^--^ SC2090: Quotes/backslashes in this variable will not be respected.
For more information:
https://www.shellcheck.net/wiki/SC2089 -- Quotes/backslashes will be treate...
https://www.shellcheck.net/wiki/SC2090 -- Quotes/backslashes in this variab... |
Ok, sounds like a shellcheck bug anyway, albeit a not that worrying one, and not really introduced or made worse by this PR, so feel free to merge at will. Would you mind reporting the shellcheck issue upstream? |
Maybe this is not really a bug of shellcheck, but shellcheck tries to find the value of uninitialized function func2 { local var; var=1; echo $var; } If shellcheck misses something, that's the fact that the local variable I'll later again check and merge this PR. Thank you! |
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
In #735, I'd like to refactor the function names
quote
anddequote
, but another branch that I created two months ago contains an improved version_comp_dequote
and improved uses ofquote
, so I'd like to process this branch before #735 if possible.