Skip to content

SubTaskfiles#23

Open
johanvo wants to merge 7 commits intoproductionfrom
subtaskfiles
Open

SubTaskfiles#23
johanvo wants to merge 7 commits intoproductionfrom
subtaskfiles

Conversation

@johanvo
Copy link
Contributor

@johanvo johanvo commented Aug 8, 2025

What

  • adapt task:help in the Taskfile-generator template so it can accept a filename as parameter $1 (it defaults to $0, consistent with previous behavior)
  • added documentation explaining the uses for SubTaskfiles

Why

By documenting ways to expand upon the base Taskfile concept (for advanced use-cases) we promote a consistent ecosystem and build upon shared experience, making Taskfiles more useful for everyone.

Specifically: in cases where you have groups of tasks that are only useful in certain contexts, SubTaskfiles allow you to keep them logically grouped with a minimum of overhead, no weird syntax and all the general niceties of a regular Taskfile (its-just-bash, simple help output, access to general usability functions, etc.

Example of minimal SubTaskfile setup

Relevant parts of ./Taskfile

#!/usr/bin/env bash

function task:foo { ## Call SubTaskfile
	SUBTASKFILE_DIR="./path/to/subtaskfile/"

	source "$SUBTASKFILE_DIR/SubTaskfile"

	task:"${@-_help}"
}

task:${@-help}

Full contents of ./path/to/subtaskfile/SubTaskfile

#!/usr/bin/env bash

function task:bar { ## Example function in SubTaskfile
	printf "foobar"
}

# Without this, you cannot run `./Taskfile foo` or `./Taskfile foo help`
function task:_help { ## Show all available tasks
	task:help "$SUBTASKFILE_DIR/SubTaskfile"
}

ToDo

  • finish PR description
  • discuss splitting up About page into general explanation and "advanced topics", including autocompletion

@johanvo johanvo changed the title WIP: Subtaskfiles SubTaskfiles Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant