-
Notifications
You must be signed in to change notification settings - Fork 2
/
zc-logo
36 lines (31 loc) · 1.19 KB
/
zc-logo
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
# Prints a graphical "logo" with ID and NAME
setopt localoptions extendedglob
integer halfl=$(( LINES / 2 )) halfc=$(( COLUMNS / 2 ))
integer hlen tlen
local text headerline=" Zconvey" headerline2=""
__zconvey_get_name_of_id "$ZCONVEY_ID"
if [ -z "$REPLY" ]; then
text="ID: <$ZCONVEY_ID> NAME: (no name assigned)"
else
text="ID: <$ZCONVEY_ID> NAME: $REPLY"
fi
tlen="${#text}"
hlen=tlen+4
headerline="${(r:hlen:: :)headerline}"
headerline="${headerline/Zconvey/\033[1;34mZconvey\033[0m\033[1;44m}"
headerline2="${(r:hlen:: :)headerline2}"
text="${text/(#b)(<[[:digit:]]#>)/\033[1;32m${match[1]}\033[1;33m}"
text="${text/(#b)NAME: (?#)/NAME: \033[1;32m${match[1]}\033[0m}"
[ "$1" != "echo" ] && {
echotc sc
echotc cm $(( halfl - 3 )) $(( halfc - hlen/2 ))
print -n "\033[1;44m$headerline\033[0m"
echotc cm $(( halfl - 2 )) $(( halfc - hlen/2 ))
print -n "\033[1;44m \033[0m \033[1;33m$text\033[0m \033[1;44m \033[0m"
echotc cm $(( halfl - 1 )) $(( halfc - hlen/2 ))
print -n "\033[1;44m$headerline2\033[0m"
echotc rc
} || {
print "\033[1;44m$headerline\033[0m\n\033[1;44m \033[0m \033[1;33m$text\033[0m \033[1;44m \033[0m\n\033[1;44m$headerline2\033[0m"
}
# vim:ft=zsh