Add include folder for extra functions

This commit is contained in:
Stig-Ørjan Smelror 2024-01-28 18:32:26 +01:00
parent 873a977c49
commit 93a2a7b3f8
6 changed files with 108 additions and 0 deletions

63
include/common/colors.inc Executable file
View File

@ -0,0 +1,63 @@
# Here you set the colors you want in the output of view and search
#
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Red 1;31
# Purple 0;35 Light Purple 1;35
# Brown 0;33 Yellow 1;33
# Light Gray 0;37 White 1;37
LIGHTGREEN="\033[1;32m"
YELLOW="\033[1;33m"
WHITE="\033[1;37m"
BLACK="\033[0;30m"
BLUE="\033[0;34m"
GREEN="\033[0;32m"
CYAN="\033[0;36m"
RED="\033[0;31m"
PURPLE="\033[0;35m"
BROWN="\033[0;33m"
LIGHTGRAY="\033[0;37m"
DARKGRAY="\033[1;30m"
LIGHTBLUE="\033[1;34m"
LIGHTCYAN="\033[1;36m"
LIGHTRED="\033[1;31m"
LIGHTPURPLE="\033[1;35m"
END="\033[0m"
LightGreen="\033[1;32m"
Yellow="\033[1;33m"
White="\033[1;37m"
Black="\033[0;30m"
Blue="\033[0;34m"
Green="\033[0;32m"
Cyan="\033[0;36m"
Red="\033[0;31m"
Purple="\033[0;35m"
Brown="\033[0;33m"
LightGray="\033[0;37m"
DarkGray="\033[1;30m"
LightBlue="\033[1;34m"
LightCyan="\033[1;36m"
LightRed="\033[1;31m"
LightPurple="\033[1;35m"
End="\033[0m"
lightgreen="\033[1;32m"
yellow="\033[1;33m"
white="\033[1;37m"
black="\033[0;30m"
blue="\033[0;34m"
green="\033[0;32m"
cyan="\033[0;36m"
red="\033[0;31m"
purple="\033[0;35m"
brown="\033[0;33m"
lightgray="\033[0;37m"
darkgray="\033[1;30m"
lightblue="\033[1;34m"
lightcyan="\033[1;36m"
lightred="\033[1;31m"
lightpurple="\033[1;35m"
end="\033[0m"

View File

@ -0,0 +1,14 @@
function doClang() {
export CC=clang
export CXX=clang++
}
function doGcc() {
export CC=gcc
export CXX=g++
}
function undoCompiler() {
unset CC
unset CXX
}

View File

@ -0,0 +1,11 @@
# Converts a --with=option,option2 into an array
# Usage: InputToArray <input-string>
# Returns: $InputArray
function InputToArray () {
if [[ ${@} =~ "--with" ]]; then
InputArray=( $( echo ${@} | cut -d= -f2 | sed -e 's/\,/\ /g' ) )
fi
}

7
include/common/loggy.inc Normal file
View File

@ -0,0 +1,7 @@
# Function: LOGGER
# Usage: loggy <message>
function loggy () {
echo "$$ - $(date +%T) - ${KODIVERSION} - ${@}" >> ${LOGGYLOGFILE}
}

View File

@ -0,0 +1,4 @@
# Find the number of available cores and return variable NUMCPU
# You can use this i.e. to "make -j${NUMCPU}"
NUMCPU=$(getconf _NPROCESSORS_ONLN)

View File

@ -0,0 +1,9 @@
# This function creates an array of a *nix path
# Example: /home/user/bin becomes an array of ( home user bin )
function slash_to_array () {
sta=( $( echo ${1} | sed -e "s/\//\ /g" ) )
# return ${sta}
}