Browse Source

Updated colored text to print in brackets, added color code lookups, neatened up output

pull/525/head
Jared Ballou 9 years ago
parent
commit
6e85dc17f9
  1. 2
      .gitignore
  2. 27
      Insurgency/insserver
  3. 1
      functions/game_settings.sh

2
.gitignore

@ -4,6 +4,6 @@
*/cfg/servers/*
*/lgsm/functions/*
*/lgsm/cfg/servers/*
*/lgsm/games/*
*/lgsm/cfg/gamedata/*
*/lgsm/settings.tmp/*

27
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}"

1
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

Loading…
Cancel
Save