Skip to content

Commit 4190642

Browse files
author
Johan van Overbeeke
committed
Allow running help on/for other Taskfiles
1 parent 3c034fe commit 4190642

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Generator/GeneredTaskfile/taskfile-base.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ function title {
5252
echo -e "\n${BLUE}=>${RESET} $1\n"
5353
}
5454

55+
# shellcheck disable=SC2120
5556
function task:help { ## Show all available tasks
57+
TASKFILE_FILE=${1-$0}
5658
title "Available tasks"
5759
awk 'BEGIN {FS = " { [#][#][ ]?"} /^([a-zA-Z_-]*:?.*)(\{ )?[#][#][ ]?/ \
58-
{printf "\033[33m%-34s\033[0m %s\n", $1, $2}' $0 |\
60+
{printf "\033[33m%-34s\033[0m %s\n", $1, $2}' "$TASKFILE_FILE" |\
5961
sed -E "s/[#]{2,}[ ]*/${RESET}/g" |\
6062
sed -E "s/function task:*/ /g"
61-
echo -e "\n${BLUE}Usage:${RESET} ./Taskfile ${YELLOW}<task>${RESET} <args>"
63+
echo -e "\n${BLUE}Usage:${RESET} $TASKFILE_FILE ${YELLOW}<task>${RESET} <args>"
6264
}
6365

6466
function task:shorthand { ## Create CLI shorthand task instead of ./Taskfile

0 commit comments

Comments
 (0)