generated from spaceship-prompt/spaceship-section
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspaceship-vue.plugin.zsh
executable file
·44 lines (35 loc) · 1.56 KB
/
spaceship-vue.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#
# Vue.js
#
# Vue.js is an approachable, performant and versatile framework for building web user interfaces.
# Link: https://vuejs.org
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_VUE_SHOW="${SPACESHIP_VUE_SHOW=true}"
SPACESHIP_VUE_ASYNC="${SPACESHIP_VUE_ASYNC=true}"
SPACESHIP_VUE_PREFIX="${SPACESHIP_VUE_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_VUE_SUFFIX="${SPACESHIP_VUE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_VUE_SYMBOL="${SPACESHIP_VUE_SYMBOL="𝗩 "}"
SPACESHIP_VUE_COLOR="${SPACESHIP_VUE_COLOR="114"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_vue() {
[[ $SPACESHIP_VUE_SHOW == false ]] && return
# Upsearch for vue package.json file
local vue_package="$(spaceship::upsearch node_modules/vue/package.json)"
# If package.json file is not found, exit
[[ -z "$vue_package" ]] && return
# Get vue version from package.json file
local vue_version="$(spaceship::datafile --json $vue_package version)"
# Check if tool version is correct
[[ -z $vue_version || "$vue_version" == "null" || "$vue_version" == "undefined" ]] && return
# Display vue section
spaceship::section::v4 \
--color "$SPACESHIP_VUE_COLOR" \
--prefix "$SPACESHIP_VUE_PREFIX" \
--suffix "$SPACESHIP_VUE_SUFFIX" \
--symbol "$SPACESHIP_VUE_SYMBOL" \
"v$vue_version"
}