Skip to content
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

Small adjustment in order to make yarn-completion.bash compatible to zsh #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions yarn-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1015,14 +1015,17 @@ _yarn_yarn() {
}

_yarn() {
# shellcheck disable=SC2064
trap "
PWD=$PWD
$(shopt -p extglob)
set +o pipefail
" RETURN

shopt -s extglob
if [[ "$SHELL" != "/bin/zsh" && "$SHELL" != "/usr/bin/zsh" ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if zsh is installed in a non-standard path? Like if installed by homebrew or something? Is there a more reliable way of determining this?

Or perhaps instead of making this a check of the negative ("this shell is not zsh"), maybe it would be better to make this a check of the affirmative ("this shell is bash").

# shellcheck disable=SC2064
trap "
PWD=$PWD
$(shopt -p extglob)
set +o pipefail
" RETURN

shopt -s extglob
fi

set -o pipefail

declare cur cmd prev
Expand Down