aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgc2gs.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/gc2gs.sh b/gc2gs.sh
index 3edf696..7e79ff0 100755
--- a/gc2gs.sh
+++ b/gc2gs.sh
@@ -14,16 +14,16 @@ LICENSE="The Drunken BEER License v 1.1 (https://git.p4g.club/git/beer/about)"
# show help
show_help () {
-test $# = 0 || echo "$@"
-echo "${SCRIPTNAME} version $VERSION"
+test "${#}" = 0 || echo "${@}"
+echo "${SCRIPTNAME} version ${VERSION}"
echo " by ${AUTHOR}"
echo " License: ${LICENSE}"
echo
echo "${SCRIPTNAME} is a shellscript that posts a status message to a"
echo " gnu-social node with the last commit information of a git-project"
echo
-echo "Usage: $0 [OPTIONS] <args> ..."
-echo "Usage: $0 [-[ckp]vh] projectname"
+echo "Usage: ${0} [OPTIONS] <args> ..."
+echo "Usage: ${0} [-[ckp]vh] projectname"
echo
echo "Options"
echo " -c <projectname> Create a configuration file for 'projectname'"
@@ -37,7 +37,7 @@ echo
echo "For more details about this script go to"
echo "Official Repository: https://git.p4g.club/git/gc2gs"
echo "Mirror Repository: https://gitgud.io/ziggys/gc2gs"
-exit $?
+exit "${?}"
}
# configure new project.config
@@ -52,7 +52,7 @@ configure () {
test "${OVERANS}" = "no" \
&& printf "you will be using old project.config file\\n" \
- && exit $? \
+ && exit "${?}" \
|| echo "" > "${RCFILE}"
printf "\\nPlease enter your gnu-social account information\\n"
@@ -63,8 +63,8 @@ configure () {
printf "'node' (url w/o trainling slash 'https://myno.de'): " \
&& read -r CONFNODE
# obfuscate user and password
- CONFUNAME="$(echo "$CONFUNAME" | base64 -)"
- CONFPASS="$(echo "$CONFPASS" | base64 -)"
+ CONFUNAME="$(echo "${CONFUNAME}" | base64 -)"
+ CONFPASS="$(echo "${CONFPASS}" | base64 -)"
printf "\\nPlease enter your git project information\\n"
printf "git project (the name of your git repository): " \
@@ -89,7 +89,7 @@ configure () {
&& read -r HOOKANS
test "${HOOKANS}" = "no" \
&& printf "done!\\n" \
- && exit $? \
+ && exit "${?}" \
|| hook_config
}
@@ -100,7 +100,7 @@ hook_config () {
test ! -d "${REPOPATH}" \
&& printf "\\n%s is not a directory... exiting" "${REPOPATH}" \
- && exit $? \
+ && exit "${?}" \
|| isgit
test ! -z "${ISGIT}" \
@@ -115,9 +115,9 @@ hook_config () {
isgit () {
cd "${REPOPATH}" || echo "${REPOPATH}" > /dev/null
git rev-parse > /dev/null
- test "$?" -ne 0 \
+ test "${?}" -ne 0 \
&& printf "\\n%s is not a git repository, exiting..." "${REPOPATH}" \
- && exit $? \
+ && exit "${?}" \
|| ISGIT="notnull"
}
@@ -155,7 +155,7 @@ status_config () {
COMMITURL="${PROJECTURL}/${COMMITURI}"
# status message
- TTITLE="${TTITTLE:="The $PROJECT project"}"
+ TTITLE="${TTITTLE:="The ${PROJECT} project"}"
printf "%s\\n\\n | New commit on branch %s by %s (at %s):\\n\\n" \
"${TTITLE}" "${BRANCH}" "${COMMITTER}" "${COMMITDATE}" >> "${TSTATUS}"
printf "%s (%s)\\n\\ncommit_url: %s\\n\\nproject_url: %s" \
@@ -175,7 +175,7 @@ gs_post () {
curl -s -u "$USER:$PASSWORD" --data-urlencode status="${STATUS}" \
-d source="${SCRIPTNAME}" "${NODE}/api/statuses/update.xml" > "${VOUTPUT}"
- test "$?" -lt 1 && printf "%s\\n" "$PME" || printf "%s\\n" "$NPME"
+ test "$?" -lt 1 && printf "%s\\n" "${PME}" || printf "%s\\n" "${NPME}"
test ! -z "${VERBOSE}" && cat "${VOUTPUT}"
}
@@ -212,7 +212,7 @@ SNIPPET="snippet/snippet"
HOOKPATH=".git/hooks/pre-push"
# input variables
-sed '/^#/ d; s/;[ \t].*//g; s/;$//g; s/[ \t]*$//g' "${RCFILE}" > "$INPUT"
+sed '/^#/ d; s/;[ \t].*//g; s/;$//g; s/[ \t]*$//g' "${RCFILE}" > "${INPUT}"
USER="$(sed '/USER=/ !d; s/USER=//' "$INPUT")"
PASSWORD="$(sed '/PASSWORD=/ !d; s/PASSWORD=//' "$INPUT")"