mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-26 01:07:34 +00:00
hooks: convert to printf
This commit is contained in:
parent
3193169256
commit
c296899fda
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
#### $$VERSION$$ v1.21-pre-4-g3193169
|
||||||
|
|
||||||
############
|
############
|
||||||
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
||||||
@ -15,8 +15,7 @@ LASTPUSH='.git/.lastcommit'
|
|||||||
# if any command inside script returns error, exit and return that error
|
# if any command inside script returns error, exit and return that error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#echo "Running post-commit hook"
|
#printf "Running post-commit hook\n............................\n"
|
||||||
#echo "............................"
|
|
||||||
|
|
||||||
unset IFS; set -f
|
unset IFS; set -f
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v1.21-dev-10-g9bfc27a
|
#### $$VERSION$$ v1.21-pre-4-g3193169
|
||||||
|
|
||||||
############
|
############
|
||||||
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
||||||
@ -15,16 +15,15 @@ LASTPUSH='.git/.lastpush'
|
|||||||
# if any command inside script returns error, exit and return that error
|
# if any command inside script returns error, exit and return that error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "Running pre-commit hook"
|
printf "Running pre-commit hook\n............................\n"
|
||||||
echo "............................"
|
|
||||||
|
|
||||||
unset IFS; set -f
|
unset IFS; set -f
|
||||||
|
|
||||||
# check for shellcheck
|
# check for shellcheck
|
||||||
if command -v shellcheck >/dev/null 2>&1; then
|
if command -v shellcheck >/dev/null 2>&1; then
|
||||||
echo "Test all scripts with shellcheck"
|
printf "Test all scripts with shellcheck\n"
|
||||||
else
|
else
|
||||||
echo "Error: shellcheck is not installed. Please install shellcheck"
|
printf "Error: shellcheck is not installed. Please install shellcheck\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -36,8 +35,7 @@ FILES="${FILES} $(sed '/^#/d' <"dev/shellcheck.files")"
|
|||||||
if [ "$FILES" != "" ]; then
|
if [ "$FILES" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
shellcheck -x ${FILES} || exit 1
|
shellcheck -x ${FILES} || exit 1
|
||||||
echo " OK"
|
printf " OK\n............................\n"
|
||||||
echo "............................"
|
|
||||||
else
|
else
|
||||||
# something went wrong
|
# something went wrong
|
||||||
exit 1
|
exit 1
|
||||||
@ -48,31 +46,28 @@ VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//' -e 's/,/./')"
|
|||||||
|
|
||||||
|
|
||||||
# LOCAL version must greater than latest REMOTE release version
|
# LOCAL version must greater than latest REMOTE release version
|
||||||
echo "Update Version of modified files"
|
printf "Update Version of modified files\n"
|
||||||
if ! command -v bc &> /dev/null || (( $(echo "${VERSION} >= ${REMOTEVER}" | bc -l) )); then
|
if ! command -v bc &> /dev/null || (( $(printf "%s\n" "${VERSION} >= ${REMOTEVER}" | bc -l) )); then
|
||||||
# update version in bashbot files on push
|
# update version in bashbot files on push
|
||||||
set +f
|
set +f
|
||||||
[ -f "${LASTPUSH}" ] && LASTFILES="$(find ./* -newer "${LASTPUSH}")"
|
[ -f "${LASTPUSH}" ] && LASTFILES="$(find ./* -newer "${LASTPUSH}")"
|
||||||
[ "${LASTFILES}" = "" ] && exit
|
[ "${LASTFILES}" = "" ] && exit
|
||||||
echo -n " "
|
printf " "
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
dev/version.sh ${LASTFILES} 2>/dev/null || exit 1
|
dev/version.sh ${LASTFILES} 2>/dev/null || exit 1
|
||||||
echo " OK"
|
printf " OK\n............................\n"
|
||||||
echo "............................"
|
|
||||||
else
|
else
|
||||||
echo "Error: local version ${VERSION} must be equal to or greater then release version ${REMOTEVER}."
|
printf "Error: local version %s must be equal to or greater then release version%s\n" "${VERSION}" "${REMOTEVER}."
|
||||||
echo "use \"git tag vx.zz\" to create a new local version"
|
printf "use \"git tag vx.zz\" to create a new local version\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v codespell &>/dev/null; then
|
if command -v codespell &>/dev/null; then
|
||||||
echo "Running codespell"
|
printf "Running codespell\n............................\n"
|
||||||
echo "............................"
|
|
||||||
codespell -q 3 --skip="*.zip,*gz,*.log,*.html,*.txt,.git*,jsonDB-keyboard" -L "ba"
|
codespell -q 3 --skip="*.zip,*gz,*.log,*.html,*.txt,.git*,jsonDB-keyboard" -L "ba"
|
||||||
echo "if there are (to many) typo's shown, consider running:"
|
printf "if there are (to many) typo's shown, consider running:\ncodespell -i 3 -w --skip=\"*.log,*.html,*.txt,.git*,examples\" -L \"ba\"\n"
|
||||||
echo "codespell -i 3 -w --skip=\"*.log,*.html,*.txt,.git*,examples\" -L \"ba\""
|
|
||||||
else
|
else
|
||||||
echo "consider installing codespell: pip install codespell"
|
printf "consider installing codespell: pip install codespell\n"
|
||||||
fi
|
fi
|
||||||
echo "............................"
|
printf "............................\n"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ v1.20-0-g2ab00a2
|
#### $$VERSION$$ v1.21-pre-4-g3193169
|
||||||
|
|
||||||
############
|
############
|
||||||
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
||||||
@ -15,8 +15,7 @@ LASTPUSH='.git/.lastpush'
|
|||||||
# if any command inside script returns error, exit and return that error
|
# if any command inside script returns error, exit and return that error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "Running pre-push hook"
|
printf "Running pre-push hook\n............................\n"
|
||||||
echo "............................"
|
|
||||||
|
|
||||||
unset IFS; set -f
|
unset IFS; set -f
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# If you your bot is finished you can use make-standalone.sh to create the
|
# If you your bot is finished you can use make-standalone.sh to create the
|
||||||
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
|
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.21-pre-3-gbbbf57c
|
#### $$VERSION$$ v1.21-pre-4-g3193169
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
@ -43,7 +43,7 @@ source "$GIT_DIR/../dev/inject-json.sh"
|
|||||||
# here the magic starts
|
# here the magic starts
|
||||||
# create all in one bashbot.sh file
|
# create all in one bashbot.sh file
|
||||||
|
|
||||||
printf "OK, now lets do the magic ...\n... create unified commands.sh\n"
|
printf "OK, now lets do the magic ...\n\t... create unified commands.sh\n"
|
||||||
|
|
||||||
{
|
{
|
||||||
# first head of commands.sh
|
# first head of commands.sh
|
||||||
@ -62,7 +62,7 @@ printf "OK, now lets do the magic ...\n... create unified commands.sh\n"
|
|||||||
mv $$commands.sh commands.sh
|
mv $$commands.sh commands.sh
|
||||||
rm -f mycommands.sh
|
rm -f mycommands.sh
|
||||||
|
|
||||||
printf " ... create unified bashbot.sh\n"
|
printf "\n... create unified bashbot.sh\n"
|
||||||
|
|
||||||
{
|
{
|
||||||
# first head of bashbot.sh
|
# first head of bashbot.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user