Provide version information in help and --version|-V flag
This commit is contained in:
parent
9b4db4a174
commit
a71471fc40
|
@ -1,5 +1,7 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
VERSION="0.4.0"
|
||||||
|
|
||||||
# Catch signals so we don't leave zombie tasks behind if we Ctrl^C
|
# Catch signals so we don't leave zombie tasks behind if we Ctrl^C
|
||||||
# No idea why but it seems to prevent the script from working? Disable!
|
# No idea why but it seems to prevent the script from working? Disable!
|
||||||
#trap "exit" INT TERM ERR
|
#trap "exit" INT TERM ERR
|
||||||
|
@ -77,12 +79,17 @@ debug () {
|
||||||
[[ $COLORS = 1 ]] && echo -e "\e[36m$(trans debug)\e[0m$(trans $1)" | envsubst > /dev/stderr || echo "$(trans debug)$(trans $1)" | envsubst > /dev/stderr
|
[[ $COLORS = 1 ]] && echo -e "\e[36m$(trans debug)\e[0m$(trans $1)" | envsubst > /dev/stderr || echo "$(trans debug)$(trans $1)" | envsubst > /dev/stderr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version() {
|
||||||
|
echo "forgebuild $VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
help () {
|
help () {
|
||||||
echo "forgebuild [tasks]"
|
version
|
||||||
|
echo "Usage: forgebuild [tasks]"
|
||||||
echo " Trigger updates on \`tasks\` (all tasks by default)"
|
echo " Trigger updates on \`tasks\` (all tasks by default)"
|
||||||
echo "ARGS:"
|
echo "ARGS:"
|
||||||
echo " -f: force run of tasks regardless of updates on the repository"
|
echo " -f: force run of tasks regardless of updates on the repository"
|
||||||
echo " -b BASEDIR: consider tasks from BASEDIR, not ~/.forgebuild"
|
echo " -b BASEDIR: load tasks from BASEDIR (defaults to ~/.forgebuild)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# DVCS stuff (for tasks with source)
|
# DVCS stuff (for tasks with source)
|
||||||
|
@ -264,6 +271,9 @@ for arg in "$@"; do
|
||||||
elif [[ "$arg" = "-h" ]] || [[ "$arg" = "--help" ]]; then
|
elif [[ "$arg" = "-h" ]] || [[ "$arg" = "--help" ]]; then
|
||||||
help
|
help
|
||||||
exit 0
|
exit 0
|
||||||
|
elif [[ "$arg" = "-V" ]] || [[ "$arg" = "--version" ]]; then
|
||||||
|
version
|
||||||
|
exit 0
|
||||||
elif [[ "$arg" = "-b" ]] || [[ "$arg" = "--basedir" ]]; then
|
elif [[ "$arg" = "-b" ]] || [[ "$arg" = "--basedir" ]]; then
|
||||||
FOUND_BASEDIR=1
|
FOUND_BASEDIR=1
|
||||||
elif [ -x $BASEDIR/$arg ]; then
|
elif [ -x $BASEDIR/$arg ]; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user