1
0
mirror of https://github.com/Mayccoll/Gogh.git synced 2023-08-10 21:12:46 +03:00

Trim White space

This commit is contained in:
mquintero 2017-12-27 11:45:55 -05:00
parent 3fe930dfdd
commit ca5c0146e2

15
gogh.sh
View File

@ -168,15 +168,18 @@ declare -a THEMES=(
capitalize (){ capitalize (){
local RES="" local RES=""
local STR=""
local RES_NO_TRAIL_SPACE=""
local string=$1 local string=$1
for char in $string for char in $string
do do
str=$(echo "${char:0:1}" | tr "[:lower:]" "[:upper:]")"${char:1}" STR=$(echo "${char:0:1}" | tr "[:lower:]" "[:upper:]")"${char:1} "
RES="${RES}${str}" RES="${RES}${STR}"
RES_NO_TRAIL_SPACE="$(echo -e "${RES}" | sed -e 's/[[:space:]]*$//')"
done done
echo "${RES}" echo "${RES_NO_TRAIL_SPACE}"
} }
function curlsource() { function curlsource() {
@ -199,6 +202,7 @@ set_gogh () {
export {PROFILE_NAME,PROFILE_SLUG}="$result" && curlsource "${url}" export {PROFILE_NAME,PROFILE_SLUG}="$result" && curlsource "${url}"
else else
export {PROFILE_NAME,PROFILE_SLUG}="$result" && source <(wget -O - "${url}") export {PROFILE_NAME,PROFILE_SLUG}="$result" && source <(wget -O - "${url}")
echo "$result"
fi fi
} }
@ -227,7 +231,7 @@ for TH in "${THEMES[@]}"; do
KEY=$(printf "%02d" $NUM) KEY=$(printf "%02d" $NUM)
FILENAME=${TH::$((${#TH}-3))} FILENAME=${TH::$((${#TH}-3))}
FILENAME_SPACE=${FILENAME//-/} FILENAME_SPACE=${FILENAME//-/ }
echo -e " (\\033[0m\033[0;34m $KEY \\033[0m\033[0m) $(capitalize "${FILENAME_SPACE}")" echo -e " (\\033[0m\033[0;34m $KEY \\033[0m\033[0m) $(capitalize "${FILENAME_SPACE}")"
@ -252,7 +256,8 @@ for OP in "${OPTION[@]}"; do
FILENAME=$(remove_file_extension "${THEMES[((OP-1))]}") FILENAME=$(remove_file_extension "${THEMES[((OP-1))]}")
FILENAME_SPACE="${FILENAME//-/ }" FILENAME_SPACE="${FILENAME//-/ }"
echo "Theme: $(capitalize "${FILENAME_SPACE}")" echo -e "\nTheme: $(capitalize "${FILENAME_SPACE}")\n\033[0;30m•\\033[0m\033[0;31m•\\033[0m\033[0;32m•\\033[0m\033[0;33m•\\033[0m\033[0;34m•\\033[0m\033[0;35m•\\033[0m\033[0;36m•\\033[0m\033[0;37m•\\033[0m \033[0;37m•\\033[0m\033[0;36m•\\033[0m\033[0;35m•\\033[0m\033[0;34m•\\033[0m\033[0;33m•\\033[0m\033[0;32m•\\033[0m\033[0;31m•\\033[0m\033[0;30m•\\033[0m\n"
SET_THEME="${THEMES[((OP-1))]}" SET_THEME="${THEMES[((OP-1))]}"
set_gogh "${SET_THEME}" set_gogh "${SET_THEME}"
else else