-
Notifications
You must be signed in to change notification settings - Fork 16
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
[WIP] Adds partial support for the unofficial bash strict mode #230
Conversation
@@ -26,7 +26,7 @@ _@go.set_search_paths() { | |||
# A plugin's own local plugin paths will appear before inherited ones. If | |||
# there is a version incompatibility issue with other installed plugins, this | |||
# allows a plugin's preferred version to take precedence. | |||
@go.search_plugins '_@go.set_search_paths_add_plugin_paths' | |||
@go.search_plugins '_@go.set_search_paths_add_plugin_paths' || : |
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.
@go.search_plugins
returns 1 some times. Based on the fact that without strict mode, the script executes without errors, I guess that when it returns 1, it is not an actual error. It is probably meant to help when @go.search_plugin
is used in an if statement.
If the above is correct, @go.seach_plugin
is used in an if statement only once in the whole project, while it is used 8 times as here. Should the function be redesigned or, if the above 'fix' is sufficient, should the same 'fix' be applied in all other 7 case?
I have a question. When using bash autocomplete, there are around 4,5 commands that return '1' if no candidate for completion is found. When setting |
completion_item_reference="$completions_reference[$i]" | ||
if [[ "${!completion_item_reference}" == "$arg" ]]; then | ||
if [[ "${!completion_item_reference-}" == "$arg" ]]; then | ||
unset "$completions_reference[$i]" |
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.
Here, it would make sense to me to actually reduce num_completions
by one as the array indeed has one less item. But if I do this, then ./go test modules/arg-completion
fails on the last test. Why is that?
a2b0fd4
to
2494be9
Compare
contribution under the same terms as this project's license, and
that I have the right to license my contribution under those terms.
cc: @mbland
I run my scripts with
set -euo pipefail
at the very top. I run into some unbound variables when doing so. Maybe I'll run into more as I move into using this framework. I think it is good to have default values/explicit null to make assumptions in the code clearer.On the part where I changed
:=
to:-
, I did so to avoid running the same value assignment twice.This PR is regardless of #220, but it could prove handy if #220 starts getting implemented. This PR is meant to support those users that do want the strict mode in their scripts.