From 6938e47102391a9cab130532911a737b6016cbf4 Mon Sep 17 00:00:00 2001 From: southerntofu Date: Wed, 25 Nov 2020 17:51:57 +0100 Subject: [PATCH] Add help flag, ensure sourceless task working dir (basedir) --- forgebuild.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/forgebuild.sh b/forgebuild.sh index 463ae85..c15101f 100755 --- a/forgebuild.sh +++ b/forgebuild.sh @@ -62,7 +62,7 @@ debug () { help () { echo "forgebuild [tasks]" - echo " Trigger updates on `tasks` (all tasks by default)" + echo " Trigger updates on \`tasks\` (all tasks by default)" echo "ARGS:" echo " -f: force run of tasks regardless of updates on the repository" echo " -b BASEDIR: consider tasks from BASEDIR, not ~/.forgebuild" @@ -248,6 +248,9 @@ for arg in "$@"; do elif [[ "$arg" = "-f" ]] || [[ "$arg" = "--force" ]]; then info force_flag FORCE=1 + elif [[ "$arg" = "-h" ]] || [[ "$arg" = "--help" ]]; then + help + exit 0 elif [[ "$arg" = "-b" ]] || [[ "$arg" = "--basedir" ]]; then FOUND_BASEDIR=1 elif [ -x $BASEDIR/$arg ]; then @@ -328,6 +331,7 @@ for p_name in ${PROJECTS[*]}; do # If $p_name.done exists, the task was already run [ -f $BASEDIR/$p_name.done ] && continue # If the task fails, don't register the .done + cd $BASEDIR run $p_name && touch $BASEDIR/$p_name.done continue fi