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

Handle GREP_OPTIONS env variable #629

Merged
merged 2 commits into from
Dec 2, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.2.2
develop
16 changes: 9 additions & 7 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ antigen () {

if [[ -n "$bundle" ]]; then
local dir=$(-antigen-get-clone-dir $ANTIGEN_DEFAULT_REPO_URL)
echo $(ls $dir/themes/ | grep '.zsh-theme$' | sed 's/.zsh-theme//')
echo $(ls $dir/themes/ | eval "$_ANTIGEN_GREP_COMMAND '.zsh-theme$'" | sed 's/.zsh-theme//')
fi

return 0
Expand Down Expand Up @@ -466,7 +466,9 @@ antigen () {

# Compatibility with oh-my-zsh themes.
-antigen-set-default _ANTIGEN_THEME_COMPAT true


-antigen-set-default _ANTIGEN_GREP_COMMAND 'GREP_OPTIONS= command grep '

# Add default built-in extensions to load at start up
-antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'

Expand Down Expand Up @@ -872,7 +874,7 @@ antigen-bundles () {
# quoting rules applied.
local line
setopt localoptions no_extended_glob # See https://github.com/zsh-users/antigen/issues/456
grep '^[[:space:]]*[^[:space:]#]' | while read line; do
eval "$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'" | while read line; do
antigen-bundle ${=line%#*}
done
}
Expand Down Expand Up @@ -996,7 +998,7 @@ antigen-init () {
fi

# Otherwise we expect it to be a heredoc
grep '^[[:space:]]*[^[:space:]#]' | while read -r line; do
eval "$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'" | while read -r line; do
eval $line
done
}
Expand Down Expand Up @@ -1380,7 +1382,7 @@ antigen-use () {
fi
}
antigen-version () {
local version="v2.2.2"
local version="develop"
local extensions revision=""
if [[ -d $_ANTIGEN_INSTALL_DIR/.git ]]; then
revision=" ($(git --git-dir=$_ANTIGEN_INSTALL_DIR/.git rev-parse --short '@'))"
Expand Down Expand Up @@ -1808,7 +1810,7 @@ typeset -g _ZCACHE_CAPTURE_PREFIX
cat > $ANTIGEN_CACHE <<EOC
#-- START ZCACHE GENERATED FILE
#-- GENERATED: $(date)
#-- ANTIGEN v2.2.2
#-- ANTIGEN develop
$(functions -- _antigen)
antigen () {
local MATCH MBEGIN MEND
Expand All @@ -1833,7 +1835,7 @@ ${(j::)_sources}
typeset -gaU _ANTIGEN_BUNDLE_RECORD; _ANTIGEN_BUNDLE_RECORD=($(print ${(qq)_ANTIGEN_BUNDLE_RECORD}))
typeset -g _ANTIGEN_CACHE_LOADED; _ANTIGEN_CACHE_LOADED=true
typeset -ga _ZCACHE_BUNDLE_SOURCE; _ZCACHE_BUNDLE_SOURCE=($(print ${(qq)_ZCACHE_BUNDLE_SOURCE}))
typeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='v2.2.2'
typeset -g _ANTIGEN_CACHE_VERSION; _ANTIGEN_CACHE_VERSION='develop'

#-- END ZCACHE GENERATED FILE
EOC
Expand Down
2 changes: 1 addition & 1 deletion src/commands/bundles.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ antigen-bundles () {
# quoting rules applied.
local line
setopt localoptions no_extended_glob # See https://github.com/zsh-users/antigen/issues/456
grep '^[[:space:]]*[^[:space:]#]' | while read line; do
eval "$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'" | while read line; do
antigen-bundle ${=line%#*}
done
}
2 changes: 1 addition & 1 deletion src/commands/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ antigen-init () {
fi

# Otherwise we expect it to be a heredoc
grep '^[[:space:]]*[^[:space:]#]' | while read -r line; do
eval "$_ANTIGEN_GREP_COMMAND '^[[:space:]]*[^[:space:]#]'" | while read -r line; do
eval $line
done
}
2 changes: 1 addition & 1 deletion src/helpers/get-themes.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

if [[ -n "$bundle" ]]; then
local dir=$(-antigen-get-clone-dir $ANTIGEN_DEFAULT_REPO_URL)
echo $(ls $dir/themes/ | grep '.zsh-theme$' | sed 's/.zsh-theme//')
echo $(ls $dir/themes/ | eval "$_ANTIGEN_GREP_COMMAND '.zsh-theme$'" | sed 's/.zsh-theme//')
fi

return 0
Expand Down
4 changes: 3 additions & 1 deletion src/lib/env-setup.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@

# Compatibility with oh-my-zsh themes.
-antigen-set-default _ANTIGEN_THEME_COMPAT true


-antigen-set-default _ANTIGEN_GREP_COMMAND 'GREP_OPTIONS= command grep '

# Add default built-in extensions to load at start up
-antigen-set-default _ANTIGEN_BUILTIN_EXTENSIONS 'lock parallel defer cache'

Expand Down
12 changes: 12 additions & 0 deletions tests/bundles.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ Again, check if they are both applied.
hehe
$ hehe2
hehe2

Handle GREP_OPTIONS gracefully.

$ GREP_OPTIONS="--color=always "
$ echo " $PLUGIN_DIR\n $PLUGIN_DIR2" | antigen-bundles

Check if they are both applied.

$ hehe
hehe
$ hehe2
hehe2