# 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