-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_speedup.sh
executable file
·97 lines (85 loc) · 3.3 KB
/
test_speedup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
source ./lib/functions.zsh
_folder_path_icon() {
if [! command -v md5 &>/dev/null]; then
local HASH_NUM="$(md5 -s $(pwd) | sed -E 's/[^0-9]//g')"
fi
local HASH_NUM="$(md5 -s $(pwd) | sed -E 's/[^0-9]//g')"
local ICON_INDEX=${HASH_NUM:0:2}
local ICONS=(
"📁" "🗄️" "🏆" "💤" "🌀" "♠️" "♥️" "♦️" "♣️" "🃏"
"🖥️" "💻" "💽" "🖱️" "🖲️" "⌨️" "🖨️" "💾" "📀" "💿"
"🧅" "🕹️" "👨💻" "🐁" "🗜️" "🤖" "🔆" "⚜️" "🔱" "💠"
"🐻" "🙈" "🙉" "🙊" "🐕" "🐺" "🐈⬛" "🦁" "🐯" "🐴"
"🐇" "🐥" "🦆" "🦢" "🦉" "🦖" "🐉" "🐲" "🕷️" "🕸️"
"🌍" "🌑" "🌓" "🌖" "🌙" "☀️" "☁️" "🌪️" "❄️" "☄️"
"🔥" "⛄" "🌊" "💧" "❤️🔥" "❤️" "🍔" "🍏" "🍎" "🍒"
"🍐" "🥕" "🌶️" "🫑" "🍄" "🍕" "🥚" "🍿" "🥡" "☕"
"🧉" "🧊" "🫐" "🥦" "🍗" "🍇" "🍓" "🥥" "😜" "😎"
"🍶" "🍾" "🍷" "🍸" "🍹" "🍺" "🍻" "🥂" "🥃" "🥤"
)
echo ${ICONS[$ICON_INDEX]}
}
_new_prompt() {
local off='\033[0m' # Text Reset
local BLUE="\e[38;5;4m"
local GREEN="\e[38;5;35m"
local FG="\e[0;36m"
local BG="\e[0;46m"
local GREEN_BG2="\e[2;32;46m"
# ✘
#
#
# 【】⟬...⟭...⟫ ❯
echo -e "${BG} ~/sd/sd/f ${off}${FG}${off}\n${BLUE}❯${off}"
echo -e "\e[31;47mКрасный текст на белом фоне\e[0m"
}
shorten_path() {
# Заменяем начальный путь $HOME на ~
local path="${PWD/#$HOME/~}"
echo $path
# Сжимаем путь, оставляя только первые буквы каждого компонента
local old_IFS="$IFS" # Сохраняем старое значение IFS
local IFS='/' # Поле разделителя для массива
local parts=($path) # Создаем массив из пути
local newpath=""
for part in "${parts[@]}"; do
# Добавляем только первую букву каждой части, если она не пустая
if [ -n "$part" ]; then
newpath+="/${part:0:1}"
fi
done
local IFS="$old_IFS" # Восстанавливаем исходное значение IFS
# Сохраняем результат в глобальной переменной
echo $newpath
}
# Использование функции
# echo '++++'
# time shorten_path
# echo '++++'
echo '[x]----------------------------'
time _get_git_avil_prompt
echo
echo '-------------------------------'
# All colors
# for x in {0..8}; do
# for i in {30..37}; do
# for a in {40..47}; do
# echo -ne "\033[$x;$i;$a""m\\\033[$x;$i;$a""m\033[0;37;40m "
# done
# echo
# done
# done
# echo ""
for fgbg in 38 48 ; do # Foreground / Background
for color in {0..255} ; do # Colors
# Display the color with padding
VALUE=$(printf '%-16s' "\\\033[${fgbg};5;${color}m")
echo -en "\033[${fgbg};5;${color}m$VALUE\033[0m "
# Display 10 colors per line
if [ $((($color + 1) % 10)) == 0 ] ; then
echo # New line
fi
done
echo # New line
done