From 6e85dc17f9497e1eea5976b9d86f54c7ba619d60 Mon Sep 17 00:00:00 2001 From: Jared Ballou Date: Tue, 19 Jan 2016 01:57:47 -0500 Subject: [PATCH] Updated colored text to print in brackets, added color code lookups, neatened up output --- .gitignore | 2 +- Insurgency/insserver | 27 +++++++++++++++++++++++---- functions/game_settings.sh | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5a4d10b29..9b6560184 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ */cfg/servers/* */lgsm/functions/* */lgsm/cfg/servers/* -*/lgsm/games/* +*/lgsm/cfg/gamedata/* */lgsm/settings.tmp/* diff --git a/Insurgency/insserver b/Insurgency/insserver index 0c9603762..3f62f25ef 100755 --- a/Insurgency/insserver +++ b/Insurgency/insserver @@ -55,9 +55,27 @@ fi # color: Numeric color code # msg: Message. This includes all further paremeters, so there is no need to quote a message with spaces in it. fn_colortext(){ - color=$1 - msg=${@:2} - echo -e "\e[0;${color}m${msg}\e[0m" +#Black 0;30 Dark Gray 1;30 +#Red 0;31 Light Red 1;31 +#Green 0;32 Light Green 1;32 +#Brown/Orange 0;33 Yellow 1;33 +#Blue 0;34 Light Blue 1;34 +#Purple 0;35 Light Purple 1;35 +#Cyan 0;36 Light Cyan 1;36 +#Light Gray 0;37 White 1;37 + case "${1}" in + green) + color="\033[0;32m";; + yellow) + color="\033[0;33m";; + reset) + color="\033[0m";; + red) + color="\033[0;31m";; + *) + color="\033[0;${1}m";; + esac + echo -e "[${color}${@:2}\e[0m]" } # Set fetchcmd to the full path of whatever command we can to fetch files @@ -98,7 +116,7 @@ fn_getgithubfile(){ mkdir -p "${filedir}" fi githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}" - echo -e " fetching ${filename} (${githuburl})\c" + echo -ne " fetching ${filename} (${githuburl})... " if [ "$(basename ${fetchcmd})" == "curl" ]; then cmd="$fetchcmd -s --fail -o" elif [ "$(basename ${fetchcmd})" == "wget" ]; then @@ -108,6 +126,7 @@ fn_getgithubfile(){ if [ "${exec}" ]; then chmod +x "${filepath}" fi + fn_colortext 32 "DONE" fi if [ "${exec}" ]; then source "${filepath}" diff --git a/functions/game_settings.sh b/functions/game_settings.sh index ddd80487f..8bfc8f37a 100644 --- a/functions/game_settings.sh +++ b/functions/game_settings.sh @@ -102,6 +102,7 @@ fn_flush_game_settings(){ fn_import_game_settings(){ import="${gamedatadir}/${1}" importdir=$(echo "${gamedatadir}" | sed -e "s|${lgsmdir}/||g") + echo $importdir if [ ! -e $import ]; then fn_getgithubfile "${importdir}/${1}" 1 "gamedata/${1}" fi