Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Jan 2, 2019
1 parent 4a7d5f3 commit 0bd5d19
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,24 @@ function unzipRemoteFile()
fi
}

#################
# GIT UTILITIES #
#################

function getGitRepositoryNameFromCloneURL()
{
local -r cloneURL="${1}"

checkNonEmptyString "${cloneURL}" 'undefined clone url'

if [[ "$(grep -F -o '@' <<< "${cloneURL}")" != '' ]]
then
awk -F '/' '{ print $2 }' <<< "${cloneURL}" | cut -d '.' -f 1
else
awk -F '/' '{ print $5 }' <<< "${cloneURL}" | cut -d '.' -f 1
fi
}

####################
# NUMBER UTILITIES #
####################
Expand Down Expand Up @@ -1283,7 +1301,10 @@ function debug()
{
local -r message="${1}"

echo -e "\033[1;34m${message}\033[0m" 2>&1
if [[ "$(isEmptyString "${message}")" = 'false' ]]
then
echo -e "\033[1;34m${message}\033[0m" 2>&1
fi
}

function deleteSpaces()
Expand Down Expand Up @@ -1330,7 +1351,10 @@ function error()
{
local -r message="${1}"

echo -e "\033[1;31m${message}\033[0m" 1>&2
if [[ "$(isEmptyString "${message}")" = 'false' ]]
then
echo -e "\033[1;31m${message}\033[0m" 1>&2
fi
}

function escapeGrepSearchPattern()
Expand Down Expand Up @@ -1386,7 +1410,10 @@ function info()
{
local -r message="${1}"

echo -e "\033[1;36m${message}\033[0m" 2>&1
if [[ "$(isEmptyString "${message}")" = 'false' ]]
then
echo -e "\033[1;36m${message}\033[0m" 2>&1
fi
}

function invertTrueFalseString()
Expand Down Expand Up @@ -1541,7 +1568,10 @@ function warn()
{
local -r message="${1}"

echo -e "\033[1;33m${message}\033[0m" 1>&2
if [[ "$(isEmptyString "${message}")" = 'false' ]]
then
echo -e "\033[1;33m${message}\033[0m" 1>&2
fi
}

####################
Expand Down

0 comments on commit 0bd5d19

Please sign in to comment.