Created
July 16, 2020 13:30
-
-
Save titovanton/e18e9ecb9e83b99df2c781d765572a4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| LRED='\033[1;31m' | |
| LGREEN='\033[1;32m' | |
| NC='\033[0m' # No Color | |
| __border() { | |
| local COLOR=$1 | |
| local title="║ ${@:2} ║" | |
| local edge=$(echo $title | sed -E "s/%%|##//g" | sed 's/./═/g' | sed 's/^./╔/' | sed 's/.$/╗/') | |
| printf '\n' | |
| echo $edge | |
| title=$(echo $title | sed "s/%%/\\${COLOR}/g" | sed "s/##/\\${NC}/g") | |
| echo -e $title | |
| edge=$(echo $edge | sed 's/^./╚/' | sed 's/.$/╝/') | |
| echo $edge | |
| printf '\n' | |
| } | |
| border() { | |
| __border $NC $@ | |
| } | |
| success() { | |
| __border $LGREEN "%%SUCCESS:## $@" | |
| } | |
| error() { | |
| __border $LRED "%%ERROR:## $@" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment