mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
Merge branch 'fix_colors' into prepare_066
This commit is contained in:
commit
c7e543ff23
39 changed files with 589 additions and 601 deletions
|
@ -6,6 +6,270 @@
|
|||
# https://github.com/bhilburn/powerlevel9k
|
||||
################################################################
|
||||
|
||||
typeset -gAh __P9K_COLORS
|
||||
# https://jonasjacek.github.io/colors/
|
||||
# use color names by default to allow dark/light themes to adjust colors based on names
|
||||
__P9K_COLORS=(
|
||||
black 000
|
||||
maroon 001
|
||||
green 002
|
||||
olive 003
|
||||
navy 004
|
||||
purple 005
|
||||
teal 006
|
||||
silver 007
|
||||
grey 008
|
||||
red 009
|
||||
lime 010
|
||||
yellow 011
|
||||
blue 012
|
||||
fuchsia 013
|
||||
magenta 013
|
||||
aqua 014
|
||||
cyan 014
|
||||
white 015
|
||||
grey0 016
|
||||
navyblue 017
|
||||
darkblue 018
|
||||
blue3 019
|
||||
blue3 020
|
||||
blue1 021
|
||||
darkgreen 022
|
||||
deepskyblue4 023
|
||||
deepskyblue4 024
|
||||
deepskyblue4 025
|
||||
dodgerblue3 026
|
||||
dodgerblue2 027
|
||||
green4 028
|
||||
springgreen4 029
|
||||
turquoise4 030
|
||||
deepskyblue3 031
|
||||
deepskyblue3 032
|
||||
dodgerblue1 033
|
||||
green3 034
|
||||
springgreen3 035
|
||||
darkcyan 036
|
||||
lightseagreen 037
|
||||
deepskyblue2 038
|
||||
deepskyblue1 039
|
||||
green3 040
|
||||
springgreen3 041
|
||||
springgreen2 042
|
||||
cyan3 043
|
||||
darkturquoise 044
|
||||
turquoise2 045
|
||||
green1 046
|
||||
springgreen2 047
|
||||
springgreen1 048
|
||||
mediumspringgreen 049
|
||||
cyan2 050
|
||||
cyan1 051
|
||||
darkred 052
|
||||
deeppink4 053
|
||||
purple4 054
|
||||
purple4 055
|
||||
purple3 056
|
||||
blueviolet 057
|
||||
orange4 058
|
||||
grey37 059
|
||||
mediumpurple4 060
|
||||
slateblue3 061
|
||||
slateblue3 062
|
||||
royalblue1 063
|
||||
chartreuse4 064
|
||||
darkseagreen4 065
|
||||
paleturquoise4 066
|
||||
steelblue 067
|
||||
steelblue3 068
|
||||
cornflowerblue 069
|
||||
chartreuse3 070
|
||||
darkseagreen4 071
|
||||
cadetblue 072
|
||||
cadetblue 073
|
||||
skyblue3 074
|
||||
steelblue1 075
|
||||
chartreuse3 076
|
||||
palegreen3 077
|
||||
seagreen3 078
|
||||
aquamarine3 079
|
||||
mediumturquoise 080
|
||||
steelblue1 081
|
||||
chartreuse2 082
|
||||
seagreen2 083
|
||||
seagreen1 084
|
||||
seagreen1 085
|
||||
aquamarine1 086
|
||||
darkslategray2 087
|
||||
darkred 088
|
||||
deeppink4 089
|
||||
darkmagenta 090
|
||||
darkmagenta 091
|
||||
darkviolet 092
|
||||
purple 093
|
||||
orange4 094
|
||||
lightpink4 095
|
||||
plum4 096
|
||||
mediumpurple3 097
|
||||
mediumpurple3 098
|
||||
slateblue1 099
|
||||
yellow4 100
|
||||
wheat4 101
|
||||
grey53 102
|
||||
lightslategrey 103
|
||||
mediumpurple 104
|
||||
lightslateblue 105
|
||||
yellow4 106
|
||||
darkolivegreen3 107
|
||||
darkseagreen 108
|
||||
lightskyblue3 109
|
||||
lightskyblue3 110
|
||||
skyblue2 111
|
||||
chartreuse2 112
|
||||
darkolivegreen3 113
|
||||
palegreen3 114
|
||||
darkseagreen3 115
|
||||
darkslategray3 116
|
||||
skyblue1 117
|
||||
chartreuse1 118
|
||||
lightgreen 119
|
||||
lightgreen 120
|
||||
palegreen1 121
|
||||
aquamarine1 122
|
||||
darkslategray1 123
|
||||
red3 124
|
||||
deeppink4 125
|
||||
mediumvioletred 126
|
||||
magenta3 127
|
||||
darkviolet 128
|
||||
purple 129
|
||||
darkorange3 130
|
||||
indianred 131
|
||||
hotpink3 132
|
||||
mediumorchid3 133
|
||||
mediumorchid 134
|
||||
mediumpurple2 135
|
||||
darkgoldenrod 136
|
||||
lightsalmon3 137
|
||||
rosybrown 138
|
||||
grey63 139
|
||||
mediumpurple2 140
|
||||
mediumpurple1 141
|
||||
gold3 142
|
||||
darkkhaki 143
|
||||
navajowhite3 144
|
||||
grey69 145
|
||||
lightsteelblue3 146
|
||||
lightsteelblue 147
|
||||
yellow3 148
|
||||
darkolivegreen3 149
|
||||
darkseagreen3 150
|
||||
darkseagreen2 151
|
||||
lightcyan3 152
|
||||
lightskyblue1 153
|
||||
greenyellow 154
|
||||
darkolivegreen2 155
|
||||
palegreen1 156
|
||||
darkseagreen2 157
|
||||
darkseagreen1 158
|
||||
paleturquoise1 159
|
||||
red3 160
|
||||
deeppink3 161
|
||||
deeppink3 162
|
||||
magenta3 163
|
||||
magenta3 164
|
||||
magenta2 165
|
||||
darkorange3 166
|
||||
indianred 167
|
||||
hotpink3 168
|
||||
hotpink2 169
|
||||
orchid 170
|
||||
mediumorchid1 171
|
||||
orange3 172
|
||||
lightsalmon3 173
|
||||
lightpink3 174
|
||||
pink3 175
|
||||
plum3 176
|
||||
violet 177
|
||||
gold3 178
|
||||
lightgoldenrod3 179
|
||||
tan 180
|
||||
mistyrose3 181
|
||||
thistle3 182
|
||||
plum2 183
|
||||
yellow3 184
|
||||
khaki3 185
|
||||
lightgoldenrod2 186
|
||||
lightyellow3 187
|
||||
grey84 188
|
||||
lightsteelblue1 189
|
||||
yellow2 190
|
||||
darkolivegreen1 191
|
||||
darkolivegreen1 192
|
||||
darkseagreen1 193
|
||||
honeydew2 194
|
||||
lightcyan1 195
|
||||
red1 196
|
||||
deeppink2 197
|
||||
deeppink1 198
|
||||
deeppink1 199
|
||||
magenta2 200
|
||||
magenta1 201
|
||||
orangered1 202
|
||||
indianred1 203
|
||||
indianred1 204
|
||||
hotpink 205
|
||||
hotpink 206
|
||||
mediumorchid1 207
|
||||
darkorange 208
|
||||
salmon1 209
|
||||
lightcoral 210
|
||||
palevioletred1 211
|
||||
orchid2 212
|
||||
orchid1 213
|
||||
orange1 214
|
||||
sandybrown 215
|
||||
lightsalmon1 216
|
||||
lightpink1 217
|
||||
pink1 218
|
||||
plum1 219
|
||||
gold1 220
|
||||
lightgoldenrod2 221
|
||||
lightgoldenrod2 222
|
||||
navajowhite1 223
|
||||
mistyrose1 224
|
||||
thistle1 225
|
||||
yellow1 226
|
||||
lightgoldenrod1 227
|
||||
khaki1 228
|
||||
wheat1 229
|
||||
cornsilk1 230
|
||||
grey100 231
|
||||
grey3 232
|
||||
grey7 233
|
||||
grey11 234
|
||||
grey15 235
|
||||
grey19 236
|
||||
grey23 237
|
||||
grey27 238
|
||||
grey30 239
|
||||
grey35 240
|
||||
grey39 241
|
||||
grey42 242
|
||||
grey46 243
|
||||
grey50 244
|
||||
grey54 245
|
||||
grey58 246
|
||||
grey62 247
|
||||
grey66 248
|
||||
grey70 249
|
||||
grey74 250
|
||||
grey78 251
|
||||
grey82 252
|
||||
grey85 253
|
||||
grey89 254
|
||||
grey93 255
|
||||
)
|
||||
|
||||
function termColors() {
|
||||
if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == true ]]; then
|
||||
return
|
||||
|
@ -28,345 +292,56 @@ function termColors() {
|
|||
|
||||
# get the proper color code if it does not exist as a name.
|
||||
function getColor() {
|
||||
# no need to check numerical values
|
||||
if [[ "$1" = <-> ]]; then
|
||||
if [[ "$1" = <8-15> ]]; then
|
||||
1=$(($1 - 8))
|
||||
fi
|
||||
else
|
||||
# named color added to parameter expansion print -P to test if the name exists in terminal
|
||||
local named="%K{$1}"
|
||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
local default="$'\033'\[49m"
|
||||
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
|
||||
local quoted=$(printf "%q" $(print -P "$named"))
|
||||
if [[ $quoted = "$'\033'\[49m" && $1 != "black" ]]; then
|
||||
# color not found, so try to get the code
|
||||
1=$(getColorCode $1)
|
||||
fi
|
||||
# If Color is not numerical, try to get the color code.
|
||||
if [[ "$1" != <-> ]]; then
|
||||
1=$(getColorCode $1)
|
||||
fi
|
||||
echo -n "$1"
|
||||
}
|
||||
|
||||
# empty paramenter resets (stops) background color
|
||||
function backgroundColor() {
|
||||
if [[ -z $1 ]]; then
|
||||
echo -n "%k"
|
||||
else
|
||||
echo -n "%K{$(getColor $1)}"
|
||||
fi
|
||||
echo -n "%K{$(getColor $1)}"
|
||||
}
|
||||
|
||||
# empty paramenter resets (stops) foreground color
|
||||
function foregroundColor() {
|
||||
if [[ -z $1 ]]; then
|
||||
echo -n "%f"
|
||||
else
|
||||
echo -n "%F{$(getColor $1)}"
|
||||
fi
|
||||
echo -n "%F{$(getColor $1)}"
|
||||
}
|
||||
|
||||
# Get numerical color codes. That way we translate ANSI codes
|
||||
# into ZSH-Style color codes.
|
||||
function getColorCode() {
|
||||
# Check if given value is already numerical
|
||||
if [[ "$1" = <-> ]]; then
|
||||
# ANSI color codes distinguish between "foreground"
|
||||
# and "background" colors. We don't need to do that,
|
||||
# as ZSH uses a 256 color space anyway.
|
||||
if [[ "$1" = <8-15> ]]; then
|
||||
echo -n $(($1 - 8))
|
||||
else
|
||||
echo -n "$1"
|
||||
fi
|
||||
# Check if value is none with any case.
|
||||
elif [[ "${(L)1}" == "none" ]]
|
||||
then
|
||||
echo -n 'none'
|
||||
else
|
||||
typeset -A codes
|
||||
# https://jonasjacek.github.io/colors/
|
||||
# use color names by default to allow dark/light themes to adjust colors based on names
|
||||
codes[black]=000
|
||||
codes[maroon]=001
|
||||
codes[green]=002
|
||||
codes[olive]=003
|
||||
codes[navy]=004
|
||||
codes[purple]=005
|
||||
codes[teal]=006
|
||||
codes[silver]=007
|
||||
codes[grey]=008
|
||||
codes[red]=009
|
||||
codes[lime]=010
|
||||
codes[yellow]=011
|
||||
codes[blue]=012
|
||||
codes[fuchsia]=013
|
||||
codes[magenta]=013
|
||||
codes[aqua]=014
|
||||
codes[cyan]=014
|
||||
codes[white]=015
|
||||
codes[grey0]=016
|
||||
codes[navyblue]=017
|
||||
codes[darkblue]=018
|
||||
codes[blue3]=019
|
||||
codes[blue3]=020
|
||||
codes[blue1]=021
|
||||
codes[darkgreen]=022
|
||||
codes[deepskyblue4]=023
|
||||
codes[deepskyblue4]=024
|
||||
codes[deepskyblue4]=025
|
||||
codes[dodgerblue3]=026
|
||||
codes[dodgerblue2]=027
|
||||
codes[green4]=028
|
||||
codes[springgreen4]=029
|
||||
codes[turquoise4]=030
|
||||
codes[deepskyblue3]=031
|
||||
codes[deepskyblue3]=032
|
||||
codes[dodgerblue1]=033
|
||||
codes[green3]=034
|
||||
codes[springgreen3]=035
|
||||
codes[darkcyan]=036
|
||||
codes[lightseagreen]=037
|
||||
codes[deepskyblue2]=038
|
||||
codes[deepskyblue1]=039
|
||||
codes[green3]=040
|
||||
codes[springgreen3]=041
|
||||
codes[springgreen2]=042
|
||||
codes[cyan3]=043
|
||||
codes[darkturquoise]=044
|
||||
codes[turquoise2]=045
|
||||
codes[green1]=046
|
||||
codes[springgreen2]=047
|
||||
codes[springgreen1]=048
|
||||
codes[mediumspringgreen]=049
|
||||
codes[cyan2]=050
|
||||
codes[cyan1]=051
|
||||
codes[darkred]=052
|
||||
codes[deeppink4]=053
|
||||
codes[purple4]=054
|
||||
codes[purple4]=055
|
||||
codes[purple3]=056
|
||||
codes[blueviolet]=057
|
||||
codes[orange4]=058
|
||||
codes[grey37]=059
|
||||
codes[mediumpurple4]=060
|
||||
codes[slateblue3]=061
|
||||
codes[slateblue3]=062
|
||||
codes[royalblue1]=063
|
||||
codes[chartreuse4]=064
|
||||
codes[darkseagreen4]=065
|
||||
codes[paleturquoise4]=066
|
||||
codes[steelblue]=067
|
||||
codes[steelblue3]=068
|
||||
codes[cornflowerblue]=069
|
||||
codes[chartreuse3]=070
|
||||
codes[darkseagreen4]=071
|
||||
codes[cadetblue]=072
|
||||
codes[cadetblue]=073
|
||||
codes[skyblue3]=074
|
||||
codes[steelblue1]=075
|
||||
codes[chartreuse3]=076
|
||||
codes[palegreen3]=077
|
||||
codes[seagreen3]=078
|
||||
codes[aquamarine3]=079
|
||||
codes[mediumturquoise]=080
|
||||
codes[steelblue1]=081
|
||||
codes[chartreuse2]=082
|
||||
codes[seagreen2]=083
|
||||
codes[seagreen1]=084
|
||||
codes[seagreen1]=085
|
||||
codes[aquamarine1]=086
|
||||
codes[darkslategray2]=087
|
||||
codes[darkred]=088
|
||||
codes[deeppink4]=089
|
||||
codes[darkmagenta]=090
|
||||
codes[darkmagenta]=091
|
||||
codes[darkviolet]=092
|
||||
codes[purple]=093
|
||||
codes[orange4]=094
|
||||
codes[lightpink4]=095
|
||||
codes[plum4]=096
|
||||
codes[mediumpurple3]=097
|
||||
codes[mediumpurple3]=098
|
||||
codes[slateblue1]=099
|
||||
codes[yellow4]=100
|
||||
codes[wheat4]=101
|
||||
codes[grey53]=102
|
||||
codes[lightslategrey]=103
|
||||
codes[mediumpurple]=104
|
||||
codes[lightslateblue]=105
|
||||
codes[yellow4]=106
|
||||
codes[darkolivegreen3]=107
|
||||
codes[darkseagreen]=108
|
||||
codes[lightskyblue3]=109
|
||||
codes[lightskyblue3]=110
|
||||
codes[skyblue2]=111
|
||||
codes[chartreuse2]=112
|
||||
codes[darkolivegreen3]=113
|
||||
codes[palegreen3]=114
|
||||
codes[darkseagreen3]=115
|
||||
codes[darkslategray3]=116
|
||||
codes[skyblue1]=117
|
||||
codes[chartreuse1]=118
|
||||
codes[lightgreen]=119
|
||||
codes[lightgreen]=120
|
||||
codes[palegreen1]=121
|
||||
codes[aquamarine1]=122
|
||||
codes[darkslategray1]=123
|
||||
codes[red3]=124
|
||||
codes[deeppink4]=125
|
||||
codes[mediumvioletred]=126
|
||||
codes[magenta3]=127
|
||||
codes[darkviolet]=128
|
||||
codes[purple]=129
|
||||
codes[darkorange3]=130
|
||||
codes[indianred]=131
|
||||
codes[hotpink3]=132
|
||||
codes[mediumorchid3]=133
|
||||
codes[mediumorchid]=134
|
||||
codes[mediumpurple2]=135
|
||||
codes[darkgoldenrod]=136
|
||||
codes[lightsalmon3]=137
|
||||
codes[rosybrown]=138
|
||||
codes[grey63]=139
|
||||
codes[mediumpurple2]=140
|
||||
codes[mediumpurple1]=141
|
||||
codes[gold3]=142
|
||||
codes[darkkhaki]=143
|
||||
codes[navajowhite3]=144
|
||||
codes[grey69]=145
|
||||
codes[lightsteelblue3]=146
|
||||
codes[lightsteelblue]=147
|
||||
codes[yellow3]=148
|
||||
codes[darkolivegreen3]=149
|
||||
codes[darkseagreen3]=150
|
||||
codes[darkseagreen2]=151
|
||||
codes[lightcyan3]=152
|
||||
codes[lightskyblue1]=153
|
||||
codes[greenyellow]=154
|
||||
codes[darkolivegreen2]=155
|
||||
codes[palegreen1]=156
|
||||
codes[darkseagreen2]=157
|
||||
codes[darkseagreen1]=158
|
||||
codes[paleturquoise1]=159
|
||||
codes[red3]=160
|
||||
codes[deeppink3]=161
|
||||
codes[deeppink3]=162
|
||||
codes[magenta3]=163
|
||||
codes[magenta3]=164
|
||||
codes[magenta2]=165
|
||||
codes[darkorange3]=166
|
||||
codes[indianred]=167
|
||||
codes[hotpink3]=168
|
||||
codes[hotpink2]=169
|
||||
codes[orchid]=170
|
||||
codes[mediumorchid1]=171
|
||||
codes[orange3]=172
|
||||
codes[lightsalmon3]=173
|
||||
codes[lightpink3]=174
|
||||
codes[pink3]=175
|
||||
codes[plum3]=176
|
||||
codes[violet]=177
|
||||
codes[gold3]=178
|
||||
codes[lightgoldenrod3]=179
|
||||
codes[tan]=180
|
||||
codes[mistyrose3]=181
|
||||
codes[thistle3]=182
|
||||
codes[plum2]=183
|
||||
codes[yellow3]=184
|
||||
codes[khaki3]=185
|
||||
codes[lightgoldenrod2]=186
|
||||
codes[lightyellow3]=187
|
||||
codes[grey84]=188
|
||||
codes[lightsteelblue1]=189
|
||||
codes[yellow2]=190
|
||||
codes[darkolivegreen1]=191
|
||||
codes[darkolivegreen1]=192
|
||||
codes[darkseagreen1]=193
|
||||
codes[honeydew2]=194
|
||||
codes[lightcyan1]=195
|
||||
codes[red1]=196
|
||||
codes[deeppink2]=197
|
||||
codes[deeppink1]=198
|
||||
codes[deeppink1]=199
|
||||
codes[magenta2]=200
|
||||
codes[magenta1]=201
|
||||
codes[orangered1]=202
|
||||
codes[indianred1]=203
|
||||
codes[indianred1]=204
|
||||
codes[hotpink]=205
|
||||
codes[hotpink]=206
|
||||
codes[mediumorchid1]=207
|
||||
codes[darkorange]=208
|
||||
codes[salmon1]=209
|
||||
codes[lightcoral]=210
|
||||
codes[palevioletred1]=211
|
||||
codes[orchid2]=212
|
||||
codes[orchid1]=213
|
||||
codes[orange1]=214
|
||||
codes[sandybrown]=215
|
||||
codes[lightsalmon1]=216
|
||||
codes[lightpink1]=217
|
||||
codes[pink1]=218
|
||||
codes[plum1]=219
|
||||
codes[gold1]=220
|
||||
codes[lightgoldenrod2]=221
|
||||
codes[lightgoldenrod2]=222
|
||||
codes[navajowhite1]=223
|
||||
codes[mistyrose1]=224
|
||||
codes[thistle1]=225
|
||||
codes[yellow1]=226
|
||||
codes[lightgoldenrod1]=227
|
||||
codes[khaki1]=228
|
||||
codes[wheat1]=229
|
||||
codes[cornsilk1]=230
|
||||
codes[grey100]=231
|
||||
codes[grey3]=232
|
||||
codes[grey7]=233
|
||||
codes[grey11]=234
|
||||
codes[grey15]=235
|
||||
codes[grey19]=236
|
||||
codes[grey23]=237
|
||||
codes[grey27]=238
|
||||
codes[grey30]=239
|
||||
codes[grey35]=240
|
||||
codes[grey39]=241
|
||||
codes[grey42]=242
|
||||
codes[grey46]=243
|
||||
codes[grey50]=244
|
||||
codes[grey54]=245
|
||||
codes[grey58]=246
|
||||
codes[grey62]=247
|
||||
codes[grey66]=248
|
||||
codes[grey70]=249
|
||||
codes[grey74]=250
|
||||
codes[grey78]=251
|
||||
codes[grey82]=252
|
||||
codes[grey85]=253
|
||||
codes[grey89]=254
|
||||
codes[grey93]=255
|
||||
# Early exit: Check if given value is already numerical
|
||||
if [[ "$1" == <-> ]]; then
|
||||
# Pad color with zeroes
|
||||
echo -n "${(l:3::0:)1}"
|
||||
return
|
||||
fi
|
||||
|
||||
# for testing purposes in terminal
|
||||
if [[ "$1" == "foreground" ]]; then
|
||||
# call via `getColorCode foreground`
|
||||
for i in "${(k@)codes}"; do
|
||||
print -P "$(foregroundColor $i)$(getColor $i) - $i$(foregroundColor)"
|
||||
done
|
||||
elif [[ "$1" == "background" ]]; then
|
||||
# call via `getColorCode background`
|
||||
for i in "${(k@)codes}"; do
|
||||
print -P "$(backgroundColor $i)$(getColor $i) - $i$(backgroundColor)"
|
||||
done
|
||||
else
|
||||
#[[ -n "$1" ]] bg="%K{$1}" || bg="%k"
|
||||
# Strip eventual "bg-" prefixes
|
||||
1=${1#bg-}
|
||||
# Strip eventual "fg-" prefixes
|
||||
1=${1#fg-}
|
||||
# Strip eventual "br" prefixes ("bright" colors)
|
||||
1=${1#br}
|
||||
echo -n $codes[$1]
|
||||
fi
|
||||
local colorName="${1}"
|
||||
# Check if value is none with any case.
|
||||
if [[ "${(L)colorName}" == "none" ]]; then
|
||||
echo -n 'none'
|
||||
elif [[ "${colorName}" == "foreground" ]]; then
|
||||
# for testing purposes in terminal
|
||||
# call via `getColorCode foreground`
|
||||
for i in "${(k@)__P9K_COLORS}"; do
|
||||
print -P "$(foregroundColor $i)$(getColor $i) - $i%f"
|
||||
done
|
||||
elif [[ "${colorName}" == "background" ]]; then
|
||||
# call via `getColorCode background`
|
||||
for i in "${(k@)__P9K_COLORS}"; do
|
||||
print -P "$(backgroundColor $i)$(getColor $i) - $i%k"
|
||||
done
|
||||
else
|
||||
# Strip eventual "bg-" prefixes
|
||||
colorName=${colorName#bg-}
|
||||
# Strip eventual "fg-" prefixes
|
||||
colorName=${colorName#fg-}
|
||||
# Strip eventual "br" prefixes ("bright" colors)
|
||||
colorName=${colorName#br}
|
||||
echo -n $__P9K_COLORS[$colorName]
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -111,45 +111,54 @@ CURRENT_BG='NONE'
|
|||
set_default last_left_element_index 1
|
||||
set_default POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS " "
|
||||
left_prompt_segment() {
|
||||
local segment_name="${1}"
|
||||
local current_index=$2
|
||||
# Check if the segment should be joined with the previous one
|
||||
local joined
|
||||
segmentShouldBeJoined $current_index $last_left_element_index "$POWERLEVEL9K_LEFT_PROMPT_ELEMENTS" && joined=true || joined=false
|
||||
|
||||
# Colors
|
||||
local backgroundColor="${3}"
|
||||
local foregroundColor="${4}"
|
||||
|
||||
# Overwrite given background-color by user defined variable for this segment.
|
||||
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND
|
||||
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND
|
||||
local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}
|
||||
[[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER"
|
||||
[[ -n $BG_COLOR_MODIFIER ]] && backgroundColor="$BG_COLOR_MODIFIER"
|
||||
|
||||
# Overwrite given foreground-color by user defined variable for this segment.
|
||||
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND
|
||||
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND
|
||||
local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}
|
||||
[[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER"
|
||||
[[ -n $FG_COLOR_MODIFIER ]] && foregroundColor="$FG_COLOR_MODIFIER"
|
||||
|
||||
local bg fg
|
||||
[[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)"
|
||||
[[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)"
|
||||
# Get color codes here to save some calls later on
|
||||
backgroundColor="$(getColorCode ${backgroundColor})"
|
||||
foregroundColor="$(getColorCode ${foregroundColor})"
|
||||
|
||||
if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "$3" "$CURRENT_BG"; then
|
||||
echo -n "$bg%F{$CURRENT_BG}"
|
||||
local background foreground
|
||||
[[ -n "${backgroundColor}" ]] && background="$(backgroundColor ${backgroundColor})" || background="%k"
|
||||
[[ -n "${foregroundColor}" ]] && foreground="$(foregroundColor ${foregroundColor})" || foreground="%f"
|
||||
|
||||
if [[ $CURRENT_BG != 'NONE' ]] && ! isSameColor "${backgroundColor}" "$CURRENT_BG"; then
|
||||
echo -n "${background}%F{$CURRENT_BG}"
|
||||
if [[ $joined == false ]]; then
|
||||
# Middle segment
|
||||
echo -n "$(print_icon 'LEFT_SEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
|
||||
fi
|
||||
elif isSameColor "$CURRENT_BG" "$3"; then
|
||||
elif isSameColor "$CURRENT_BG" "${backgroundColor}"; then
|
||||
# Middle segment with same color as previous segment
|
||||
# We take the current foreground color as color for our
|
||||
# subsegment (or the default color). This should have
|
||||
# enough contrast.
|
||||
local complement
|
||||
[[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)"
|
||||
echo -n "${bg}${complement}"
|
||||
[[ -n "${foregroundColor}" ]] && complement="${foreground}" || complement="$(foregroundColor $DEFAULT_COLOR)"
|
||||
echo -n "${background}${complement}"
|
||||
if [[ $joined == false ]]; then
|
||||
echo -n "$(print_icon 'LEFT_SUBSEGMENT_SEPARATOR')$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
|
||||
fi
|
||||
else
|
||||
# First segment
|
||||
echo -n "${bg}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
|
||||
echo -n "${background}$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
|
||||
fi
|
||||
|
||||
local visual_identifier
|
||||
|
@ -161,8 +170,8 @@ left_prompt_segment() {
|
|||
# we need to color both the visual identifier and the whitespace.
|
||||
[[ -n "$5" ]] && visual_identifier="$visual_identifier "
|
||||
# Allow users to overwrite the color for the visual identifier only.
|
||||
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
|
||||
set_default $visual_identifier_color_variable $4
|
||||
local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR
|
||||
set_default $visual_identifier_color_variable "${foregroundColor}"
|
||||
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
|
||||
fi
|
||||
fi
|
||||
|
@ -170,10 +179,10 @@ left_prompt_segment() {
|
|||
# Print the visual identifier
|
||||
echo -n "${visual_identifier}"
|
||||
# Print the content of the segment, if there is any
|
||||
[[ -n "$5" ]] && echo -n "${fg}${5}"
|
||||
[[ -n "$5" ]] && echo -n "${foreground}${5}"
|
||||
echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS}"
|
||||
|
||||
CURRENT_BG=$3
|
||||
CURRENT_BG="${backgroundColor}"
|
||||
last_left_element_index=$current_index
|
||||
}
|
||||
|
||||
|
@ -203,25 +212,34 @@ CURRENT_RIGHT_BG='NONE'
|
|||
set_default last_right_element_index 1
|
||||
set_default POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS " "
|
||||
right_prompt_segment() {
|
||||
local segment_name="${1}"
|
||||
local current_index=$2
|
||||
|
||||
# Check if the segment should be joined with the previous one
|
||||
local joined
|
||||
segmentShouldBeJoined $current_index $last_right_element_index "$POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS" && joined=true || joined=false
|
||||
|
||||
# Colors
|
||||
local backgroundColor="${3}"
|
||||
local foregroundColor="${4}"
|
||||
|
||||
# Overwrite given background-color by user defined variable for this segment.
|
||||
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND
|
||||
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_BACKGROUND
|
||||
local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}
|
||||
[[ -n $BG_COLOR_MODIFIER ]] && 3="$BG_COLOR_MODIFIER"
|
||||
[[ -n $BG_COLOR_MODIFIER ]] && backgroundColor="$BG_COLOR_MODIFIER"
|
||||
|
||||
# Overwrite given foreground-color by user defined variable for this segment.
|
||||
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND
|
||||
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)${segment_name}#prompt_}_FOREGROUND
|
||||
local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}
|
||||
[[ -n $FG_COLOR_MODIFIER ]] && 4="$FG_COLOR_MODIFIER"
|
||||
|
||||
local bg fg
|
||||
[[ -n "$3" ]] && bg="$(backgroundColor $3)" || bg="$(backgroundColor)"
|
||||
[[ -n "$4" ]] && fg="$(foregroundColor $4)" || fg="$(foregroundColor)"
|
||||
# Get color codes here to save some calls later on
|
||||
backgroundColor="$(getColorCode ${backgroundColor})"
|
||||
foregroundColor="$(getColorCode ${foregroundColor})"
|
||||
|
||||
local background foreground
|
||||
[[ -n "${backgroundColor}" ]] && background="$(backgroundColor ${backgroundColor})" || background="%k"
|
||||
[[ -n "${foregroundColor}" ]] && foreground="$(foregroundColor ${foregroundColor})" || foreground="%f"
|
||||
|
||||
# If CURRENT_RIGHT_BG is "NONE", we are the first right segment.
|
||||
|
||||
|
@ -231,17 +249,17 @@ right_prompt_segment() {
|
|||
fi
|
||||
|
||||
if [[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]]; then
|
||||
if isSameColor "$CURRENT_RIGHT_BG" "$3"; then
|
||||
if isSameColor "$CURRENT_RIGHT_BG" "${backgroundColor}"; then
|
||||
# Middle segment with same color as previous segment
|
||||
# We take the current foreground color as color for our
|
||||
# subsegment (or the default color). This should have
|
||||
# enough contrast.
|
||||
local complement
|
||||
[[ -n "$4" ]] && complement="$fg" || complement="$(foregroundColor $DEFAULT_COLOR)"
|
||||
[[ -n "${foregroundColor}" ]] && complement="${foreground}" || complement="$(foregroundColor $DEFAULT_COLOR)"
|
||||
echo -n "$complement$(print_icon 'RIGHT_SUBSEGMENT_SEPARATOR')%f"
|
||||
else
|
||||
# Use the new BG color for the foreground with separator
|
||||
echo -n "$(foregroundColor $3)$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f"
|
||||
# Use the new Background Color as the foreground of the segment separator
|
||||
echo -n "$(foregroundColor ${backgroundColor})$(print_icon 'RIGHT_SEGMENT_SEPARATOR')%f"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -254,13 +272,13 @@ right_prompt_segment() {
|
|||
# we need to color both the visual identifier and the whitespace.
|
||||
[[ -n "$5" ]] && visual_identifier=" $visual_identifier"
|
||||
# Allow users to overwrite the color for the visual identifier only.
|
||||
local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
|
||||
set_default $visual_identifier_color_variable $4
|
||||
local visual_identifier_color_variable=POWERLEVEL9K_${(U)${segment_name}#prompt_}_VISUAL_IDENTIFIER_COLOR
|
||||
set_default $visual_identifier_color_variable "${foregroundColor}"
|
||||
visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "${bg}${fg}"
|
||||
echo -n "${background}${foreground}"
|
||||
|
||||
# Print whitespace only if segment is not joined or first right segment
|
||||
[[ $joined == false ]] || [[ "$CURRENT_RIGHT_BG" == "NONE" ]] && echo -n "${POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS}"
|
||||
|
@ -270,7 +288,7 @@ right_prompt_segment() {
|
|||
# Print the visual identifier
|
||||
echo -n "${visual_identifier}"
|
||||
|
||||
CURRENT_RIGHT_BG=$3
|
||||
CURRENT_RIGHT_BG="${backgroundColor}"
|
||||
last_right_element_index=$current_index
|
||||
}
|
||||
|
||||
|
@ -278,11 +296,6 @@ right_prompt_segment() {
|
|||
# Prompt Segment Definitions
|
||||
################################################################
|
||||
|
||||
# The `CURRENT_BG` variable is used to remember what the last BG color used was
|
||||
# when building the left-hand prompt. Because the RPROMPT is created from
|
||||
# right-left but reads the opposite, this isn't necessary for the other side.
|
||||
CURRENT_BG='NONE'
|
||||
|
||||
################################################################
|
||||
# Anaconda Environment
|
||||
prompt_anaconda() {
|
||||
|
|
|
@ -16,7 +16,7 @@ function testDynamicColoringOfSegmentsWork() {
|
|||
local POWERLEVEL9K_DATE_ICON="date-icon"
|
||||
local POWERLEVEL9K_DATE_BACKGROUND='red'
|
||||
|
||||
assertEquals "%K{red} %F{black%}date-icon %f%F{black}%D{%d.%m.%y} %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{000%}date-icon %f%F{000}%D{%d.%m.%y} %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testDynamicColoringOfVisualIdentifiersWork() {
|
||||
|
@ -24,7 +24,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
|
|||
local POWERLEVEL9K_DATE_ICON="date-icon"
|
||||
local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green'
|
||||
|
||||
assertEquals "%K{white} %F{green%}date-icon %f%F{black}%D{%d.%m.%y} %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{green%}date-icon %f%F{000}%D{%d.%m.%y} %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
|
||||
|
@ -34,7 +34,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
|
|||
local POWERLEVEL9K_DATE_FOREGROUND='red'
|
||||
local POWERLEVEL9K_DATE_BACKGROUND='yellow'
|
||||
|
||||
assertEquals "%K{yellow} %F{green%}date-icon %f%F{red}%D{%d.%m.%y} %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{green%}date-icon %f%F{009}%D{%d.%m.%y} %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColorOverridingOfStatefulSegment() {
|
||||
|
@ -45,7 +45,7 @@ function testColorOverridingOfStatefulSegment() {
|
|||
# Provoke state
|
||||
local SSH_CLIENT="x"
|
||||
|
||||
assertEquals "%K{red} %F{green%}ssh-icon %f%F{green}%m %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{002%}ssh-icon %f%F{002}%m %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColorOverridingOfCustomSegment() {
|
||||
|
@ -56,7 +56,7 @@ function testColorOverridingOfCustomSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND='red'
|
||||
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND='red'
|
||||
|
||||
assertEquals "%K{red} %F{green%}CW %f%F{red}world %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{green%}CW %f%F{009}world %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -21,7 +21,7 @@ function testLeftNormalSegmentsShouldNotBeJoined() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black} %F{black}world2 %K{white}%F{black} %F{black}world4 %K{white}%F{black} %F{black}world6 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world2 %K{015}%F{000} %F{000}world4 %K{015}%F{000} %F{000}world6 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftJoinedSegments() {
|
||||
|
@ -30,7 +30,7 @@ function testLeftJoinedSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black}%F{black}world2 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftTransitiveJoinedSegments() {
|
||||
|
@ -40,7 +40,7 @@ function testLeftTransitiveJoinedSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black}%F{black}world2 %K{white}%F{black}%F{black}world3 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world3 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftTransitiveJoiningWithConditionalJoinedSegment() {
|
||||
|
@ -51,7 +51,7 @@ function testLeftTransitiveJoiningWithConditionalJoinedSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black}%F{black}world2 %K{white}%F{black}%F{black}world4 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world4 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftPromotingSegmentWithConditionalPredecessor() {
|
||||
|
@ -61,7 +61,7 @@ function testLeftPromotingSegmentWithConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black} %F{black}world3 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world3 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftPromotingSegmentWithJoinedConditionalPredecessor() {
|
||||
|
@ -72,7 +72,7 @@ function testLeftPromotingSegmentWithJoinedConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black} %F{black}world4 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() {
|
||||
|
@ -85,7 +85,7 @@ function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %K{white}%F{black} %F{black}world4 %K{white}%F{black}%F{black}world6 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %K{015}%F{000}%F{000}world6 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testLeftJoiningBuiltinSegmentWorks() {
|
||||
|
@ -93,7 +93,7 @@ function testLeftJoiningBuiltinSegmentWorks() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(php_version php_version_joined)
|
||||
alias php="echo PHP 1.2.3"
|
||||
|
||||
assertEquals "%K{013} %F{255}PHP 1.2.3 %K{013}%F{255}%F{255}PHP 1.2.3 %k%F{fuchsia}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{255}PHP 1.2.3 %K{013}%F{255}%F{255}PHP 1.2.3 %k%F{013}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ function testRightNormalSegmentsShouldNotBeJoined() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%F{black}%f%K{white}%F{black} world2 %f%F{black}%f%K{white}%F{black} world4 %f%F{black}%f%K{white}%F{black} world6%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2 %f%F{000}%f%K{015}%F{000} world4 %f%F{000}%f%K{015}%F{000} world6%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightJoinedSegments() {
|
||||
|
@ -117,7 +117,7 @@ function testRightJoinedSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%K{white}%F{black}world2%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightTransitiveJoinedSegments() {
|
||||
|
@ -127,7 +127,7 @@ function testRightTransitiveJoinedSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
|
||||
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%K{white}%F{black}world2 %f%K{white}%F{black}world3%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world3%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightTransitiveJoiningWithConditionalJoinedSegment() {
|
||||
|
@ -138,7 +138,7 @@ function testRightTransitiveJoiningWithConditionalJoinedSegment() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%K{white}%F{black}world2 %f%K{white}%F{black}world4%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world4%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightPromotingSegmentWithConditionalPredecessor() {
|
||||
|
@ -148,7 +148,7 @@ function testRightPromotingSegmentWithConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%F{black}%f%K{white}%F{black} world3%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world3%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightPromotingSegmentWithJoinedConditionalPredecessor() {
|
||||
|
@ -159,7 +159,7 @@ function testRightPromotingSegmentWithJoinedConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%F{black}%f%K{white}%F{black} world4%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() {
|
||||
|
@ -172,7 +172,7 @@ function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
|
||||
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1 %f%F{black}%f%K{white}%F{black} world4 %f%K{white}%F{black}world6%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4 %f%K{015}%F{000}world6%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testRightJoiningBuiltinSegmentWorks() {
|
||||
|
|
|
@ -22,7 +22,7 @@ function testSegmentOnRightSide() {
|
|||
powerlevel9k_prepare_prompts
|
||||
|
||||
local reset_attributes=$'\e[00m'
|
||||
assertEquals "%f%b%k%F{white}%f%K{white}%F{black} world1 %f%F{black}%f%K{white}%F{black} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}"
|
||||
assertEquals "%f%b%k%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}"
|
||||
}
|
||||
|
||||
function testDisablingRightPrompt() {
|
||||
|
@ -48,7 +48,7 @@ function testLeftMultilinePrompt() {
|
|||
powerlevel9k_prepare_prompts
|
||||
|
||||
local nl=$'\n'
|
||||
assertEquals "╭─%f%b%k%K{white} %F{black}world1 %k%F{white}%f ${nl}╰─ " "${(e)PROMPT}"
|
||||
assertEquals "╭─%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}╰─ " "${(e)PROMPT}"
|
||||
}
|
||||
|
||||
function testRightPromptOnSameLine() {
|
||||
|
@ -70,7 +70,7 @@ function testRightPromptOnSameLine() {
|
|||
startSkipping
|
||||
|
||||
powerlevel9k_prepare_prompts
|
||||
assertEquals "%{\e[1A%}%F{white}%f%K{white}%F{black} world1 %f%{\e[1B%}" "${(e)RPROMPT}"
|
||||
assertEquals "%{\e[1A%}%F{015}%f%K{015}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}"
|
||||
}
|
||||
|
||||
function testPrefixingFirstLineOnLeftPrompt() {
|
||||
|
@ -84,7 +84,7 @@ function testPrefixingFirstLineOnLeftPrompt() {
|
|||
powerlevel9k_prepare_prompts
|
||||
|
||||
local nl=$'\n'
|
||||
assertEquals "XXX%f%b%k%K{white} %F{black}world1 %k%F{white}%f ${nl}╰─ " "${(e)PROMPT}"
|
||||
assertEquals "XXX%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}╰─ " "${(e)PROMPT}"
|
||||
}
|
||||
|
||||
function testPrefixingSecondLineOnLeftPrompt() {
|
||||
|
@ -98,7 +98,7 @@ function testPrefixingSecondLineOnLeftPrompt() {
|
|||
powerlevel9k_prepare_prompts
|
||||
|
||||
local nl=$'\n'
|
||||
assertEquals "╭─%f%b%k%K{white} %F{black}world1 %k%F{white}%f ${nl}XXX" "${(e)PROMPT}"
|
||||
assertEquals "╭─%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}XXX" "${(e)PROMPT}"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
||||
|
|
|
@ -18,7 +18,7 @@ function testOverwritingIconsWork() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
|
||||
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
|
||||
|
||||
assertEquals "%K{white} %F{black%}icon-here %f%F{black}world1 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000%}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
|
||||
|
@ -27,7 +27,7 @@ function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
|
||||
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
|
||||
|
||||
assertEquals "%K{white} %F{black%}icon-here %f%F{black}world1 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000%}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
|
||||
|
@ -36,7 +36,7 @@ function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
|
|||
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
|
||||
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
|
||||
|
||||
assertEquals "%F{white}%f%K{white}%F{black} world1%F{black%} icon-here%f%E" "$(build_right_prompt)"
|
||||
assertEquals "%F{015}%f%K{015}%F{000} world1%F{000%} icon-here%f%E" "$(build_right_prompt)"
|
||||
}
|
||||
|
||||
function testVisualIdentifierPrintsNothingIfNotAvailable() {
|
||||
|
@ -44,7 +44,7 @@ function testVisualIdentifierPrintsNothingIfNotAvailable() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
|
||||
|
||||
assertEquals "%K{white} %F{black}world1 %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -30,8 +30,8 @@ function testIsSameColorComparesAnsiBackgroundAndNumericalColorCorrectly() {
|
|||
assertTrue "isSameColor 'bg-green' '002'"
|
||||
}
|
||||
|
||||
function testIsSameColorComparesNumericalBackgroundAndNumericalColorCorrectly() {
|
||||
assertTrue "isSameColor '010' '2'"
|
||||
function testIsSameColorComparesShortCodesCorrectly() {
|
||||
assertTrue "isSameColor '002' '2'"
|
||||
}
|
||||
|
||||
function testIsSameColorDoesNotYieldNotEqualColorsTruthy() {
|
||||
|
|
|
@ -21,7 +21,7 @@ function testJoinedSegments() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined)
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ function testTransitiveJoinedSegments() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined)
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ function testJoiningWithConditionalSegment() {
|
|||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined)
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function testDynamicColoringOfSegmentsWork() {
|
|||
local POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{red} %F{black}/tmp %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{000}/tmp %k%F{009}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
|
|||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{green%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{green%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
|
|||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{yellow} %F{green%}icon-here %f%F{red}/tmp %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{green%}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ function testOverwritingIconsWork() {
|
|||
#cd ~/$testFolder
|
||||
|
||||
cd /tmp
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
# rm -fr ~/$testFolder
|
||||
|
@ -117,7 +117,7 @@ function testNewlineOnRpromptCanBeDisabled() {
|
|||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_rworld)
|
||||
|
||||
powerlevel9k_prepare_prompts
|
||||
assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX)[39m[0m[49m[47m [30mworld [49m[37m[39m $(print_icon MULTILINE_LAST_PROMPT_PREFIX)[1A[39m[0m[49m[37m[39m[47m[30m rworld[K[00m[1B' "$(print -P ${PROMPT}${RPROMPT})"
|
||||
assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX)[39m[0m[49m[107m [30mworld [49m[97m[39m $(print_icon MULTILINE_LAST_PROMPT_PREFIX)[1A[39m[0m[49m[97m[39m[107m[30m rworld[K[00m[1B' "$(print -P ${PROMPT}${RPROMPT})"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
||||
|
|
|
@ -21,7 +21,7 @@ function testAnacondaSegmentPrintsNothingIfNoAnacondaPathIsSet() {
|
|||
unset CONDA_ENV_PATH
|
||||
unset CONDA_PREFIX
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
||||
|
@ -35,7 +35,7 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPathIsSet() {
|
|||
CONDA_ENV_PATH=/tmp
|
||||
unset CONDA_PREFIX
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmp) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(tmp) %k%F{012}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
||||
|
@ -49,7 +49,7 @@ function testAnacondaSegmentWorksIfOnlyAnacondaPrefixIsSet() {
|
|||
unset CONDA_ENV_PATH
|
||||
local CONDA_PREFIX="test"
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(test) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(test) %k%F{012}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAnacondaSegmentWorks() {
|
||||
|
@ -63,7 +63,7 @@ function testAnacondaSegmentWorks() {
|
|||
local CONDA_ENV_PATH=/tmp
|
||||
local CONDA_PREFIX="test"
|
||||
|
||||
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}(tmptest) %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}icon-here %f%F{000}(tmptest) %k%F{012}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -17,7 +17,7 @@ function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet()
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {
|
||||
|
@ -31,7 +31,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() {
|
|||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{002%}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
cd -
|
||||
|
@ -52,7 +52,7 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec
|
|||
echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml
|
||||
cd /tmp/powerlevel9k-test/1/12/123/1234/12345
|
||||
|
||||
assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{002%}🌱 %f%F{002}test %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
cd -
|
||||
|
|
|
@ -18,7 +18,7 @@ function testBackgroundJobsSegmentPrintsNothingWithoutBackgroundJobs() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias jobs
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ function testBackgroundJobsSegmentWorksWithOneBackgroundJob() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{014%}⚙%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function testBackgroundJobsSegmentWorksWithMultipleBackgroundJobs() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{014%}⚙%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ function testBackgroundJobsSegmentWithVerboseMode() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{cyan%}⚙ %f%F{cyan}3 %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{014%}⚙ %f%F{014}3 %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction jobs
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
|
|||
makeBatterySay "Now drawing from 'Battery Power'
|
||||
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
|
||||
|
||||
assertEquals "%K{black} %F{red%}🔋 %f%F{red}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
||||
|
@ -77,7 +77,7 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
|||
makeBatterySay "Now drawing from 'Battery Power'
|
||||
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
||||
|
@ -85,7 +85,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
|||
makeBatterySay "Now drawing from 'Battery Power'
|
||||
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
|
||||
|
||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{015%}🔋 %f%F{015}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
||||
|
@ -93,7 +93,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
|||
makeBatterySay "Now drawing from 'Battery Power'
|
||||
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{011%}🔋 %f%F{011}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsFullOnOSX() {
|
||||
|
@ -101,7 +101,7 @@ function testBatterySegmentIfBatteryIsFullOnOSX() {
|
|||
makeBatterySay "Now drawing from 'AC Power'
|
||||
-InternalBattery-0 (id=1234567) 99%; charged; 0:00 remaining present: true"
|
||||
|
||||
assertEquals "%K{black} %F{green%}🔋 %f%F{green}99%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{002%}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
||||
|
@ -109,42 +109,42 @@ function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
|||
makeBatterySay "Now drawing from 'Battery Power'
|
||||
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
|
||||
|
||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{015%}🔋 %f%F{015}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
||||
local OS='Linux' # Fake Linux
|
||||
makeBatterySay "4" "Discharging"
|
||||
|
||||
assertEquals "%K{black} %F{red%}🔋 %f%F{red}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
||||
local OS='Linux' # Fake Linux
|
||||
makeBatterySay "4" "Charging"
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
||||
local OS='Linux' # Fake Linux
|
||||
makeBatterySay "10" "Discharging"
|
||||
|
||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{015%}🔋 %f%F{015}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
||||
local OS='Linux' # Fake Linux
|
||||
makeBatterySay "10" "Charging"
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}🔋 %f%F{yellow}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{011%}🔋 %f%F{011}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsFullOnLinux() {
|
||||
local OS='Linux' # Fake Linux
|
||||
makeBatterySay "100" "Full"
|
||||
|
||||
assertEquals "%K{black} %F{green%}🔋 %f%F{green}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{002%}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
||||
|
@ -155,7 +155,7 @@ function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
|||
# For running on Mac, we need to mock date :(
|
||||
[[ -f /usr/local/bin/gdate ]] && alias date=gdate
|
||||
|
||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
|
||||
unalias date &>/dev/null
|
||||
# unaliasing date fails where it was never aliased (e.g. on Linux).
|
||||
|
@ -171,7 +171,7 @@ function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {
|
|||
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
|
||||
chmod +x ${FOLDER}/usr/bin/acpi
|
||||
|
||||
assertEquals "%K{black} %F{white%}🔋 %f%F{white}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -20,7 +20,7 @@ function testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() {
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=2
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimeThresholdCouldBeChanged() {
|
||||
|
@ -34,7 +34,7 @@ function testCommandExecutionTimeThresholdCouldBeChanged() {
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=2.03
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}2.03 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}2.03 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimeThresholdCouldBeSetToZero() {
|
||||
|
@ -43,7 +43,7 @@ function testCommandExecutionTimeThresholdCouldBeSetToZero() {
|
|||
local POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
|
||||
local _P9K_COMMAND_DURATION=0.03
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.03 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.03 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimePrecisionCouldBeChanged() {
|
||||
|
@ -58,7 +58,7 @@ function testCommandExecutionTimePrecisionCouldBeChanged() {
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=0.0001
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.0001 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.0001 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimePrecisionCouldBeSetToZero() {
|
||||
|
@ -72,7 +72,7 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=23.5001
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}23 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}23 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand() {
|
||||
|
@ -85,7 +85,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand()
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=180
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}03:00 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}03:00 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
|
||||
|
@ -98,7 +98,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
|
|||
# Override payload
|
||||
local _P9K_COMMAND_DURATION=7200
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}02:00:00 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}02:00:00 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -29,7 +29,7 @@ function testContextSegmentDoesNotGetRenderedWithDefaultUser() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
|
||||
|
@ -43,7 +43,7 @@ function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction sudo
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ function testContextSegmentWithForeignUser() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction sudo
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ function testContextSegmentWithRootUser() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testOverridingContextTemplate() {
|
||||
|
@ -83,7 +83,7 @@ function testOverridingContextTemplate() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}xx %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
||||
|
@ -95,7 +95,7 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}%n@%m %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testContextSegmentIsShownIfForced() {
|
||||
|
@ -107,7 +107,7 @@ function testContextSegmentIsShownIfForced() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}$(whoami) %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}$(whoami) %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -17,7 +17,7 @@ function testCustomDirectOutputSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testCustomClosureSegment() {
|
||||
|
@ -31,7 +31,7 @@ function testCustomClosureSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSettingBackgroundForCustomSegment() {
|
||||
|
@ -43,7 +43,7 @@ function testSettingBackgroundForCustomSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black}world %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000}world %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSettingForegroundForCustomSegment() {
|
||||
|
@ -55,7 +55,7 @@ function testSettingForegroundForCustomSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{red}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{009}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSettingVisualIdentifierForCustomSegment() {
|
||||
|
@ -67,7 +67,7 @@ function testSettingVisualIdentifierForCustomSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black%}hw %f%F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000%}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSettingVisualIdentifierForegroundColorForCustomSegment() {
|
||||
|
@ -80,7 +80,7 @@ function testSettingVisualIdentifierForegroundColorForCustomSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{red%}hw %f%F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{red%}hw %f%F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -20,7 +20,7 @@ function testDetectVirtSegmentPrintsNothingIfSystemdIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias systemd-detect-virt
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ function testDetectVirtSegmentIfSystemdReturnsPlainName() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow}xxx %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}xxx %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias systemd-detect-virt
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ function testDetectVirtSegmentIfRootFsIsOnExpectedInode() {
|
|||
# which translates to: Show the inode number of "/" and test if it is "2".
|
||||
alias ls="echo '2'"
|
||||
|
||||
assertEquals "%K{black} %F{yellow}none %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}none %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ls
|
||||
unalias systemd-detect-virt
|
||||
|
@ -74,7 +74,7 @@ function testDetectVirtSegmentIfRootFsIsNotOnExpectedInode() {
|
|||
# which translates to: Show the inode number of "/" and test if it is "2".
|
||||
alias ls="echo '3'"
|
||||
|
||||
assertEquals "%K{black} %F{yellow}chroot %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011}chroot %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ls
|
||||
unalias systemd-detect-virt
|
||||
|
|
|
@ -29,9 +29,9 @@ function testDirPathAbsoluteWorks() {
|
|||
# of /home or /Users path.. That is why we change the test
|
||||
# according to the OS of the host.
|
||||
if [[ "${OS}" == 'Linux' ]]; then
|
||||
assertEquals "%K{blue} %F{black}/home/${USER} %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/home/${USER} %k%F{012}%f " "$(build_left_prompt)"
|
||||
elif [[ "${OS}" == 'OSX' ]]; then
|
||||
assertEquals "%K{blue} %F{black}/Users/${USER} %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/Users/${USER} %k%F{012}%f " "$(build_left_prompt)"
|
||||
fi
|
||||
|
||||
cd -
|
||||
|
@ -50,7 +50,7 @@ function testTruncateFoldersWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}…/12345678/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -72,7 +72,7 @@ function testTruncateFolderWithHomeDirWorks() {
|
|||
# Switch back to home folder as this causes the problem.
|
||||
cd ..
|
||||
|
||||
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
rmdir $FOLDER
|
||||
cd ${CURRENT_DIR}
|
||||
|
@ -91,7 +91,7 @@ function testTruncateMiddleWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -110,7 +110,7 @@ function testTruncationFromRightWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -129,7 +129,7 @@ function testTruncateToLastWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -148,7 +148,7 @@ function testTruncateToFirstAndLastWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/powerlevel9k-test/…/…/…/…/…/…/…/12345678/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -167,7 +167,7 @@ function testTruncateAbsoluteWorks() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}…89 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}…89 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -187,7 +187,7 @@ function testTruncationFromRightWithEmptyDelimiter() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -207,7 +207,7 @@ function testTruncateWithFolderMarkerWorks() {
|
|||
# Setup folder marker
|
||||
touch $BASEFOLDER/1/12/.shorten_folder_marker
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $BASEFOLDER
|
||||
|
@ -228,7 +228,7 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
|||
# Setup folder marker
|
||||
touch $BASEFOLDER/1/12/.xxx
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/…/12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $BASEFOLDER
|
||||
|
@ -260,7 +260,7 @@ function testTruncateWithPackageNameWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
cd $p9kFolder
|
||||
|
@ -300,7 +300,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/as…/qwerqwer %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}My_Package/as…/qwerqwer %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
cd $p9kFolder
|
||||
|
@ -336,7 +336,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}My_Package/.g…/re…/heads %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}My_Package/.g…/re…/heads %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
# Go back
|
||||
cd $p9kFolder
|
||||
|
@ -352,7 +352,7 @@ function testHomeFolderDetectionWorks() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
cd ~
|
||||
assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ function testHomeSubfolderDetectionWorks() {
|
|||
local FOLDER=~/powerlevel9k-test
|
||||
mkdir $FOLDER
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black%}sub-icon %f%F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $FOLDER
|
||||
|
@ -385,7 +385,7 @@ function testOtherFolderDetectionWorks() {
|
|||
local FOLDER=/tmp/powerlevel9k-test
|
||||
mkdir $FOLDER
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}/tmp/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $FOLDER
|
||||
|
@ -403,7 +403,7 @@ function testChangingDirPathSeparator() {
|
|||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
|
||||
assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -421,7 +421,7 @@ function testHomeFolderAbbreviation() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
# substituted
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
|
@ -429,7 +429,7 @@ function testHomeFolderAbbreviation() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}qQq %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}qQq %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd /tmp
|
||||
# default
|
||||
|
@ -438,7 +438,7 @@ function testHomeFolderAbbreviation() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
# substituted
|
||||
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
|
||||
|
@ -446,7 +446,7 @@ function testHomeFolderAbbreviation() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd "$dir"
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ function testOmittingFirstCharacterWorks() {
|
|||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -507,7 +507,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc
|
|||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
assertEquals "%K{blue} %F{black}xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}xXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -527,7 +527,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca
|
|||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
assertEquals "%K{blue} %F{black}tmpxXxpo…stxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}tmpxXxpo…stxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -547,7 +547,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat
|
|||
mkdir -p /tmp/powerlevel9k-test/1/2
|
||||
cd /tmp/powerlevel9k-test/1/2
|
||||
|
||||
assertEquals "%K{blue} %F{black}tmpxXxpo…xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}tmpxXxpo…xXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -570,7 +570,7 @@ function testTruncateToUniqueWorks() {
|
|||
mkdir -p /tmp/powerlevel9k-test/bob/docs
|
||||
cd /tmp/powerlevel9k-test/alice/devl
|
||||
|
||||
assertEquals "%K{blue} %F{black}txXxpxXxalxXxde %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}txXxpxXxalxXxde %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -586,7 +586,7 @@ function testBoldHomeDirWorks() {
|
|||
|
||||
cd ~
|
||||
|
||||
assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}%B~%b %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ function testBoldHomeSubdirWorks() {
|
|||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}~/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}~/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr ~/powerlevel9k-test
|
||||
|
@ -618,7 +618,7 @@ function testBoldRootDirWorks() {
|
|||
|
||||
cd /
|
||||
|
||||
assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}%B/%b %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ function testBoldRootSubdirWorks() {
|
|||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/%Btmp%b %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ function testBoldRootSubSubdirWorks() {
|
|||
mkdir -p /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -665,7 +665,7 @@ function testHighlightHomeWorks() {
|
|||
|
||||
cd ~
|
||||
|
||||
assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}%F{red}~ %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ function testHighlightHomeSubdirWorks() {
|
|||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}~/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}~/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr ~/powerlevel9k-test
|
||||
|
@ -697,7 +697,7 @@ function testHighlightRootWorks() {
|
|||
|
||||
cd /
|
||||
|
||||
assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}%F{red}/ %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ function testHighlightRootSubdirWorks() {
|
|||
|
||||
cd /tmp
|
||||
|
||||
assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/%F{red}tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ function testHighlightRootSubSubdirWorks() {
|
|||
mkdir /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}/tmp/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
@ -745,7 +745,7 @@ function testDirSeparatorColorHomeSubdirWorks() {
|
|||
mkdir -p ~/powerlevel9k-test
|
||||
cd ~/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}~%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr ~/powerlevel9k-test
|
||||
|
@ -762,7 +762,7 @@ function testDirSeparatorColorRootSubSubdirWorks() {
|
|||
mkdir -p /tmp/powerlevel9k-test
|
||||
cd /tmp/powerlevel9k-test
|
||||
|
||||
assertEquals "%K{blue} %F{black}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{012} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr /tmp/powerlevel9k-test
|
||||
|
|
|
@ -40,7 +40,7 @@ function testDiskUsageSegmentWhenDiskIsAlmostFull() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{red} %F{white%}hdd %f%F{white}97%% %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{015%}hdd %f%F{015}97%% %k%F{009}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ function testDiskUsageSegmentWhenDiskIsVeryFull() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}94%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000%}hdd %f%F{000}94%% %k%F{011}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ function testDiskUsageSegmentWhenDiskIsQuiteEmpty() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}hdd %f%F{yellow}4%% %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011%}hdd %f%F{011}4%% %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ function testDiskUsageSegmentPrintsNothingIfDiskIsQuiteEmptyAndOnlyWarningsShoul
|
|||
local POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=true
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ function testDiskUsageSegmentWarningLevelCouldBeAdjusted() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}hdd %f%F{black}11%% %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000%}hdd %f%F{000}11%% %k%F{011}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ function testDiskUsageSegmentCriticalLevelCouldBeAdjusted() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{red} %F{white%}hdd %f%F{white}11%% %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{015%}hdd %f%F{015}11%% %k%F{009}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction df
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ function testGo() {
|
|||
|
||||
local PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
|
||||
|
||||
assertEquals "%K{green} %F{grey93%} %f%F{255}go1.5.3 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{255%} %f%F{255}go1.5.3 %k%F{002}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias go
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ function testGoSegmentPrintsNothingIfEmptyGopath() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testGoSegmentPrintsNothingIfNotInGopath() {
|
||||
|
@ -68,7 +68,7 @@ function testGoSegmentPrintsNothingIfNotInGopath() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testGoSegmentPrintsNothingIfGoIsNotAvailable() {
|
||||
|
@ -80,7 +80,7 @@ function testGoSegmentPrintsNothingIfGoIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias go
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ function testIpSegmentPrintsNothingOnOsxIfNotConnected() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias networksetup
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ip
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ipconfig
|
||||
unalias networksetup
|
||||
|
@ -123,7 +123,7 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ipconfig
|
||||
unalias networksetup
|
||||
|
@ -139,7 +139,7 @@ function testIpSegmentWorksOnOsxWithInterfaceSpecified() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='OSX' # Fake OSX
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}1.2.3.4 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}1.2.3.4 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias ipconfig
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ip
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ip
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
|
|||
source powerlevel9k.zsh-theme
|
||||
local OS='Linux' # Fake Linux
|
||||
|
||||
assertEquals "%K{cyan} %F{black%}IP %f%F{black}10.0.2.15 %k%F{cyan}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{014} %F{000%}IP %f%F{000}10.0.2.15 %k%F{014}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction ip
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ function testKubeContext() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/default %k%F{013}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ function testKubeContextOtherNamespace() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/kube-system %k%F{013}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ function testKubeContextPrintsNothingIfKubectlNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias kubectl
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ function testLaravelVersionSegment() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{001} %F{white%}x %f%F{white}5.4.23 %k%F{maroon}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{001} %F{015%}x %f%F{015}5.4.23 %k%F{001}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ function testLaravelVersionSegmentIfArtisanIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ function testLoadSegmentWorksOnOsx() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unfunction sysctl
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ function testLoadSegmentWorksOnBsd() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="BSD" # Fake BSD
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unfunction sysctl
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ function testLoadSegmentWorksOnLinux() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{002} %F{000%}L %f%F{000}1.38 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function testLoadSegmentNormalState() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{green} %F{black%}L %f%F{black}1.00 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{002} %F{000%}L %f%F{000}1.00 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ function testLoadSegmentWarningState() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}L %f%F{black}2.01 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}L %f%F{000}2.01 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ function testLoadSegmentCriticalState() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{red} %F{black%}L %f%F{black}2.81 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
assertEquals "%K{009} %F{000%}L %f%F{000}2.81 " "$(prompt_load left 1 false ${FOLDER})"
|
||||
|
||||
unalias nproc
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ function testNodeVersionSegmentPrintsNothingWithoutNode() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias node
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ function testNodeVersionSegmentWorks() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{white%}⬢ %f%F{white}1.2.3 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{015%}⬢ %f%F{015}1.2.3 %k%F{002}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function testNodeenvSegmentPrintsNothingWithoutNode() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias node
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvIsNotSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ function testNodeenvSegmentPrintsNothingIfNodeVirtualEnvDisablePromptIsSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unset NODE_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset NODE_VIRTUAL_ENV
|
||||
|
@ -73,7 +73,7 @@ function testNodeenvSegmentPrintsAtLeastNodeEnvWithoutNode() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}⬢ %f%F{green}[node-env] %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{002%}⬢ %f%F{002}[node-env] %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unset NODE_VIRTUAL_ENV
|
||||
unalias node
|
||||
|
@ -90,7 +90,7 @@ function testNodeenvSegmentWorks() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}⬢ %f%F{green}v1.2.3[node-env] %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{002%}⬢ %f%F{002}v1.2.3[node-env] %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction node
|
||||
unset NODE_VIRTUAL_ENV
|
||||
|
|
|
@ -37,7 +37,7 @@ function testNvmSegmentPrintsNothingIfNvmIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
||||
|
@ -51,7 +51,7 @@ function testNvmSegmentWorksWithoutHavingADefaultAlias() {
|
|||
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v1.4.0'
|
||||
}
|
||||
|
||||
assertEquals "%K{magenta} %F{black%}⬢ %f%F{black}4.6.0 %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{000%}⬢ %f%F{000}4.6.0 %k%F{013}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {
|
||||
|
@ -66,7 +66,7 @@ function testNvmSegmentPrintsNothingWhenOnDefaultVersion() {
|
|||
[[ ${1} == 'current' ]] && echo 'v4.6.0' || echo 'v4.6.0'
|
||||
}
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -18,7 +18,7 @@ function testPhpVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{013} %F{255}PHP 5.6.27 %k%F{fuchsia}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{255}PHP 5.6.27 %k%F{013}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ function testPublicIpSegmentPrintsNothingByDefaultIfHostIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ function testPublicIpSegmentPrintsNoticeIfNotConnected() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}disconnected %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}disconnected %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ function testPublicIpSegmentWorksWithWget() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}wget 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}wget 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction wget
|
||||
unalias dig
|
||||
|
@ -98,7 +98,7 @@ function testPublicIpSegmentUsesCurlAsFallbackMethodIfWgetIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}curl 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}curl 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction curl
|
||||
unalias dig
|
||||
|
@ -117,7 +117,7 @@ function testPublicIpSegmentUsesDigAsFallbackMethodIfWgetAndCurlAreNotAvailable(
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}dig 1.2.3.4 %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}dig 1.2.3.4 %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
unalias curl
|
||||
|
@ -134,14 +134,14 @@ function testPublicIpSegmentCachesFile() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
dig() {
|
||||
echo "second"
|
||||
}
|
||||
|
||||
# Segment should not have changed!
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
sleep 3
|
||||
dig() {
|
||||
|
@ -165,7 +165,7 @@ function testPublicIpSegmentRefreshesCachesFileAfterTimeout() {
|
|||
}
|
||||
|
||||
# Segment should not have changed!
|
||||
assertEquals "%K{black} %F{white}second %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}first %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}first %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
# Truncate cache file
|
||||
echo "" >! $POWERLEVEL9K_PUBLIC_IP_FILE
|
||||
|
@ -190,7 +190,7 @@ function testPublicIpSegmentRefreshesCachesFileIfEmpty() {
|
|||
}
|
||||
|
||||
# Segment should not have changed!
|
||||
assertEquals "%K{black} %F{white}second %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ function testPublicIpSegmentWhenGoingOnline() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}disconnected %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}disconnected %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias dig
|
||||
|
||||
|
@ -214,7 +214,7 @@ function testPublicIpSegmentWhenGoingOnline() {
|
|||
}
|
||||
|
||||
# Segment should not have changed!
|
||||
assertEquals "%K{black} %F{white}second %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{015}second %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction dig
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ Pages inactive: 1313411.
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}6.15G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}RAM %f%F{000}6.15G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
|
||||
unalias vm_stat
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ function testRamSegmentWorksOnBsd() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="BSD" # Fake BSD
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}0.29M " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}RAM %f%F{000}0.29M " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
function testRamSegmentWorksOnLinux() {
|
||||
|
@ -60,7 +60,7 @@ function testRamSegmentWorksOnLinux() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}RAM %f%F{black}0.29G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}RAM %f%F{000}0.29G " "$(prompt_ram left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -34,7 +34,7 @@ function testRust() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{208} %F{black%}Rust %f%F{black}0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{208} %F{000%}Rust %f%F{000}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testRustPrintsNothingIfRustIsNotAvailable() {
|
||||
|
@ -45,7 +45,7 @@ function testRustPrintsNothingIfRustIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
||||
|
|
|
@ -22,7 +22,7 @@ function testSshSegmentPrintsNothingIfNoSshConnection() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSshSegmentWorksIfOnlySshClientIsSet() {
|
||||
|
@ -37,7 +37,7 @@ function testSshSegmentWorksIfOnlySshClientIsSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_CLIENT
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ function testSshSegmentWorksIfOnlySshTtyIsSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_TTY
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ function testSshSegmentWorksIfAllNecessaryVariablesAreSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{yellow%}ssh-icon%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{011%}ssh-icon%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
|
||||
unset SSH_TTY
|
||||
unset SSH_CLIENT
|
||||
|
|
|
@ -24,7 +24,7 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
||||
|
@ -37,7 +37,7 @@ function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{green%}✔%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{002%}✔%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStatusInGeneralErrorCase() {
|
||||
|
@ -50,7 +50,7 @@ function testStatusInGeneralErrorCase() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=1
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testPipestatusInErrorCase() {
|
||||
|
@ -64,7 +64,7 @@ function testPipestatusInErrorCase() {
|
|||
local -a RETVALS
|
||||
RETVALS=(0 0 1 0)
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}0|0|1|0 %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}0|0|1|0 %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStatusCrossWinsOverVerbose() {
|
||||
|
@ -78,7 +78,7 @@ function testStatusCrossWinsOverVerbose() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=1
|
||||
|
||||
assertEquals "%K{black} %F{red%}✘%f %k%F{black}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{000} %F{009%}✘%f %k%F{000}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStatusShowsSignalNameInErrorCase() {
|
||||
|
@ -92,7 +92,7 @@ function testStatusShowsSignalNameInErrorCase() {
|
|||
source powerlevel9k.zsh-theme
|
||||
local RETVAL=132
|
||||
|
||||
assertEquals "%K{red} %F{yellow1%}↵ %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStatusSegmentIntegrated() {
|
||||
|
@ -107,7 +107,7 @@ function testStatusSegmentIntegrated() {
|
|||
|
||||
false; powerlevel9k_prepare_prompts
|
||||
|
||||
assertEquals "%f%b%k%K{black} %F{red%}✘%f %k%F{black}%f " "${(e)PROMPT}"
|
||||
assertEquals "%f%b%k%K{000} %F{009%}✘%f %k%F{000}%f " "${(e)PROMPT}"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -36,7 +36,7 @@ function testSwapSegmentWorksOnOsx() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="OSX" # Fake OSX
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}SWP %f%F{black}1.58G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}SWP %f%F{000}1.58G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
|
||||
unfunction sysctl
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function testSwapSegmentWorksOnLinux() {
|
|||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
local OS="Linux" # Fake Linux
|
||||
|
||||
assertEquals "%K{yellow} %F{black%}SWP %f%F{black}0.95G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
assertEquals "%K{011} %F{000%}SWP %f%F{000}0.95G " "$(prompt_swap left 1 false ${FOLDER})"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -34,7 +34,7 @@ function testSwiftSegmentPrintsNothingIfSwiftIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias swift
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ function testSwiftSegmentWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}Swift %f%F{white}3.0.1 %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{013} %F{015%}Swift %f%F{015}3.0.1 %k%F{013}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction swift
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ function testSymfonyVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unalias php
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ function testSymfonyVersionSegmentPrintsNothingIfSymfonyIsNotAvailable() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
||||
|
@ -68,7 +68,7 @@ function testSymfonyVersionPrintsNothingIfPhpThrowsAnError() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ function testSymfonyVersionSegmentWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{240} %F{black%}SF %f%F{black}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{240} %F{000%}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ function testSymfonyVersionSegmentWorksInNestedFolder() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{240} %F{black%}SF %f%F{black}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{240} %F{000%}SF %f%F{000}3.1.4 %k%F{240}%f " "$(build_left_prompt)"
|
||||
|
||||
unfunction php
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ function testTodoSegmentPrintsNothingIfTodoShIsNotInstalled() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testTodoSegmentWorksAsExpected() {
|
||||
|
@ -52,7 +52,7 @@ function testTodoSegmentWorksAsExpected() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{244} %F{black%}☑ %f%F{black}100 %k%F{grey50}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{244} %F{000%}☑ %f%F{000}100 %k%F{244}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -76,7 +76,7 @@ function testColorOverridingForCleanStateWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{014} master %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColorOverridingForModifiedStateWorks() {
|
||||
|
@ -93,7 +93,7 @@ function testColorOverridingForModifiedStateWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{red} master ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{009} master ● %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColorOverridingForUntrackedStateWorks() {
|
||||
|
@ -107,7 +107,7 @@ function testColorOverridingForUntrackedStateWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{014} master ? %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testGitIconWorks() {
|
||||
|
@ -117,7 +117,7 @@ function testGitIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}Git-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000%}Git-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testGitlabIconWorks() {
|
||||
|
@ -132,7 +132,7 @@ function testGitlabIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}GL-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000%}GL-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testBitbucketIconWorks() {
|
||||
|
@ -147,7 +147,7 @@ function testBitbucketIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}BB-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000%}BB-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testGitHubIconWorks() {
|
||||
|
@ -162,7 +162,7 @@ function testGitHubIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}GH-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000%}GH-Icon %f%F{000} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testUntrackedFilesIconWorks() {
|
||||
|
@ -176,7 +176,7 @@ function testUntrackedFilesIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStagedFilesIconWorks() {
|
||||
|
@ -194,7 +194,7 @@ function testStagedFilesIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master + %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000} master + %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testUnstagedFilesIconWorks() {
|
||||
|
@ -211,7 +211,7 @@ function testUnstagedFilesIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master M %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000} master M %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testStashIconWorks() {
|
||||
|
@ -229,7 +229,7 @@ function testStashIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master S1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master S1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testTagIconWorks() {
|
||||
|
@ -245,7 +245,7 @@ function testTagIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testTagIconInDetachedHeadState() {
|
||||
|
@ -266,7 +266,7 @@ function testTagIconInDetachedHeadState() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} ${hash} Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testActionHintWorks() {
|
||||
|
@ -289,7 +289,7 @@ function testActionHintWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} master %F{red}| merge%f %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000} master %F{red}| merge%f %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testIncomingHintWorks() {
|
||||
|
@ -311,7 +311,7 @@ function testIncomingHintWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master I1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master I1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testOutgoingHintWorks() {
|
||||
|
@ -333,7 +333,7 @@ function testOutgoingHintWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} master o1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master o1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testShorteningCommitHashWorks() {
|
||||
|
@ -353,7 +353,7 @@ function testShorteningCommitHashWorks() {
|
|||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
assertEquals "%K{green} %F{black}${hash} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000}${hash} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
||||
|
@ -372,7 +372,7 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
|||
# This test needs to call powerlevel9k_vcs_init, where
|
||||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
assertEquals "%K{green} %F{black} master %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} master %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -40,7 +40,7 @@ function testColorOverridingForCleanStateWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{white} %F{cyan} default %k%F{white}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{015} %F{014} default %k%F{015}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testColorOverridingForModifiedStateWorks() {
|
||||
|
@ -57,7 +57,7 @@ function testColorOverridingForModifiedStateWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{red} default ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{009} default ● %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
# There is no staging area in mercurial, therefore there are no "untracked"
|
||||
|
@ -74,7 +74,7 @@ function testAddedFilesIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} default ● %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000} default ● %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
# We don't support tagging in mercurial right now..
|
||||
|
@ -92,7 +92,7 @@ function testTagIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} default Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} default Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testTagIconInDetachedHeadState() {
|
||||
|
@ -114,7 +114,7 @@ function testTagIconInDetachedHeadState() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} ${hash} Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} ${hash} Tv0.0.1 %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testActionHintWorks() {
|
||||
|
@ -137,7 +137,7 @@ function testActionHintWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{yellow} %F{black} default %F{red}| merging%f %k%F{yellow}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{011} %F{000} default %F{red}| merging%f %k%F{011}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testShorteningCommitHashWorks() {
|
||||
|
@ -158,7 +158,7 @@ function testShorteningCommitHashWorks() {
|
|||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
||||
assertEquals "%K{green} %F{black}${hash} default %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000}${hash} default %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
||||
|
@ -178,7 +178,7 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
|
|||
# the changeset is truncated.
|
||||
powerlevel9k_vcs_init
|
||||
|
||||
assertEquals "%K{green} %F{black} default %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} default %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testMercurialIconWorks() {
|
||||
|
@ -189,7 +189,7 @@ function testMercurialIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black%}HG-Icon %f%F{black} default %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000%}HG-Icon %f%F{000} default %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
function testBookmarkIconWorks() {
|
||||
|
@ -201,7 +201,7 @@ function testBookmarkIconWorks() {
|
|||
# Load Powerlevel9k
|
||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{green} %F{black} default Binitial %k%F{green}%f " "$(build_left_prompt)"
|
||||
assertEquals "%K{002} %F{000} default Binitial %k%F{002}%f " "$(build_left_prompt)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
|
@ -15,7 +15,7 @@ function testViInsertModeWorks() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViInsertModeWorksWhenLabeledAsMain() {
|
||||
|
@ -24,7 +24,7 @@ function testViInsertModeWorksWhenLabeledAsMain() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViCommandModeWorks() {
|
||||
|
@ -33,7 +33,7 @@ function testViCommandModeWorks() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{white}NORMAL " "$(prompt_vi_mode left 1 false)"
|
||||
assertEquals "%K{000} %F{015}NORMAL " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
function testViInsertModeStringIsCustomizable() {
|
||||
|
@ -42,7 +42,7 @@ function testViInsertModeStringIsCustomizable() {
|
|||
# Load Powerlevel9k
|
||||
source powerlevel9k.zsh-theme
|
||||
|
||||
assertEquals "%K{black} %F{blue}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
assertEquals "%K{000} %F{012}INSERT " "$(prompt_vi_mode left 1 false)"
|
||||
}
|
||||
|
||||
source shunit2/shunit2
|
Loading…
Reference in a new issue