Skip to content

Commit

Permalink
Fix colors
Browse files Browse the repository at this point in the history
  • Loading branch information
grigorii-horos committed Jul 17, 2019
1 parent 009f3da commit ca59aa2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.directory
*.zwc
*.old
*~
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This plugin made to be fast. It runs in background and update information only i

## Installation

### This plugin depends on [zsh-helpres](https://github.com/zpm-zsh/helpers)
### This plugin depends on [zsh-helpres](https://github.com/zpm-zsh/helpers) and [zsh-colors](https://github.com/zpm-zsh/colors)

If you don't use [zpm](https://github.com/zpm-zsh/zpm), install it manually and activate it before this plugin.
If you use zpm you don’t need to do anything
Expand Down
35 changes: 18 additions & 17 deletions pr-node.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
#!/usr/bin/env zsh

DEPENDENCES_ZSH+=( zpm-zsh/helpers )
DEPENDENCES_ZSH+=( zpm-zsh/helpers zpm-zsh/colors )
DEPENDENCES_ARCH+=( node@nodejs )
DEPENDENCES_DEBIAN+=( node@nodejs )

NODE_VERSION_PREFIX=${NODE_VERSION_PREFIX:-" "}
NODE_VERSION_SUFIX=${NODE_VERSION_SUFIX:-""}

if command -v zpm >/dev/null; then
zpm zpm-zsh/helpers zpm-zsh/colors
fi

_node_version_pre() {

if (( $+commands[node] )); then
if is-recursive-exist package.json >/dev/null ; then
pr_node="$NODE_VERSION_PREFIX"

if is-recursive-exist gulpfile.js >/dev/null || is-recursive-exist gulpfile.babel.js >/dev/null ; then
if [[ $CLICOLOR = 1 ]]; then
pr_node+="%{$fg_bold[green]%} "
pr_node+="%{$c[green]$c_bold$c_dim%}%{$c_reset%} "
else
pr_node+=""
fi
fi

if is-recursive-exist Gruntfile.js >/dev/null ; then
if [[ $CLICOLOR = 1 ]]; then
pr_node+="%{$fg_bold[green]%} "
pr_node+="%{$c[green]$c_bold$c_dim%}%{$c_reset%} "
else
pr_node+=""
fi
fi

if is-recursive-exist webpack.config.js >/dev/null ; then
if [[ $CLICOLOR = 1 ]]; then
pr_node+="%{$fg_bold[green]%}ﰩ "
pr_node+="%{$c[green]$c_bold$c_dim%}ﰩ%{$c_reset%} "
else
pr_node+=""
fi
fi

nodev=$(node -v)
nodev=${nodev#'v'}
if [[ $CLICOLOR = 1 ]]; then
pr_node+="%{$fg_bold[green]%}⬡ %{$fg_bold[blue]%}$nodev%{$reset_color%}"
pr_node+="%{$c[green]$c_bold$c_dim%}⬡%{$c_reset%} %{$c[blue]$c_bold%}$nodev%{$c_reset%}"
else
pr_node+="$nodev"
fi

pr_node+="$NODE_VERSION_SUFIX"

else
pr_node=""
return 0
fi
else
pr_node=""
fi


pr_node=""

}
chpwd_functions+=(_node_version_pre)
periodic_functions+=(_node_version_pre)

0 comments on commit ca59aa2

Please sign in to comment.