Added colours to output level
This commit is contained in:
parent
13a420a5b1
commit
b872adb7fe
@ -14,8 +14,8 @@ GetOptions() {
|
||||
! getopt --test > /dev/null
|
||||
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
|
||||
VerboseOutput 5 "\`getopt --test\` failed"
|
||||
echo "Sorry, It seems that your shell is not supported"
|
||||
echo "If you're using mac or another unix-like system, please install GNU getopt"
|
||||
VerboseOutput 5 "Sorry, It seems that your shell is not supported"
|
||||
VerboseOutput 5 "If you're using MacOS or another unix-like system, please install GNU getopt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -69,7 +69,7 @@ GetOptions() {
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Programming error"
|
||||
VerboseOutput 5 "Programming error"
|
||||
return 3
|
||||
;;
|
||||
esac
|
||||
@ -109,26 +109,26 @@ VerboseOutput() {
|
||||
if [[ $verbose -le $1 ]]; then
|
||||
case "$1" in
|
||||
0)
|
||||
level="Verbose"
|
||||
level="\033[1;36mVerbose\033[0m"
|
||||
;;
|
||||
1)
|
||||
level=" Debug "
|
||||
level="\033[1;34m Debug \033[0m"
|
||||
;;
|
||||
2)
|
||||
level=" Info "
|
||||
level="\033[1;37m Info \033[0m"
|
||||
;;
|
||||
3)
|
||||
level="Warning"
|
||||
level="\033[1;33mWarning\033[0m"
|
||||
;;
|
||||
4)
|
||||
level=" Error "
|
||||
level="\033[1;31m Error \033[0m"
|
||||
;;
|
||||
|
||||
5)
|
||||
level=" Fatal "
|
||||
level="\033[1;30m Fatal \033[0m"
|
||||
;;
|
||||
esac
|
||||
echo "[$level] $2" >&2
|
||||
echo -e "[$level] $2" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ if [[ -f /tmp/music-sync-filelist ]]; then
|
||||
fi
|
||||
CreateFileList $source $dest ""
|
||||
if [[ ! -f /tmp/music-sync-filelist ]]; then
|
||||
VerboseOutput "Info" "Nothing to do!"
|
||||
VerboseOutput 2 "Nothing to do!"
|
||||
exit 0
|
||||
fi
|
||||
ConvertFiles
|
||||
|
Loading…
Reference in New Issue
Block a user