forked from geometry-zsh/geometry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.zsh
29 lines (21 loc) · 1 KB
/
plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Color definitions
GEOMETRY_COLOR_PACKAGER_VERSION=${GEOMETRY_COLOR_PACKAGER_VERSION:-black}
# Symbol definitions
GEOMETRY_SYMBOL_PACKAGER_VERSION=${GEOMETRY_SYMBOL_PACKAGER_VERSION:-"⬡"}
GEOMETRY_NODE_PACKAGER_VERSION=$(prompt_geometry_colorize $GEOMETRY_COLOR_PACKAGER_VERSION $GEOMETRY_SYMBOL_PACKAGER_VERSION)
geometry_prompt_node_setup() {
(( $+commands[node] )) || (( $+commands[yarn] )) || return 1
}
geometry_prompt_node_check() {
test -f package.json || test -f yarn.lock || return 1
}
geometry_prompt_node_render() {
local GEOMETRY_NODE_DEFAULT_PACKAGE_MANAGER=npm
if [[ $+commands[yarn] && -f yarn.lock ]]; then
GEOMETRY_NODE_DEFAULT_PACKAGE_MANAGER=yarn
fi
GEOMETRY_PACKAGER_VERSION="$($GEOMETRY_NODE_DEFAULT_PACKAGE_MANAGER --version 2> /dev/null)"
GEOMETRY_NODE_VERSION="$(node -v 2> /dev/null)"
echo "$GEOMETRY_NODE_PACKAGER_VERSION $GEOMETRY_NODE_VERSION ($GEOMETRY_NODE_DEFAULT_PACKAGE_MANAGER:$GEOMETRY_PACKAGER_VERSION)"
}
geometry_plugin_register node