Skip to content

SubTaskfiles#23

Merged
rick-nu merged 28 commits intoproductionfrom
subtaskfiles
Mar 27, 2026
Merged

SubTaskfiles#23
rick-nu merged 28 commits intoproductionfrom
subtaskfiles

Conversation

@johanvo
Copy link
Copy Markdown
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
@rick-nu
Copy link
Copy Markdown
Member

rick-nu commented Mar 9, 2026

Hey @johanvo. First off all, hats off! 🚀 This looks like a GREAT addition! I have some small findings to improve this even further, let's discuss them IRL. I'm dropping them here in the PR FYI and to write out my thoughts.

@rick-nu
Copy link
Copy Markdown
Member

rick-nu commented Mar 9, 2026

I would love to see a generator option - [ ] Include SubTaskfile that gives you an example of a SubTaskfile ready for you to copy over

@rick-nu
Copy link
Copy Markdown
Member

rick-nu commented Mar 23, 2026

@johanvo with the latest code from the generator, I can't run sub tasks, it keeps showing me the "help" output:

task haos status

  ▗▄▄▖▗▄▄▄▖▗▄▄▖ ▗▖  ▗▖▗▄▄▄▖▗▄▄▖   ▗▄▄▖ ▗▄▄▄▖ ▗▄▄▖▗▖ ▗▖  ▗▖  ▗▖▗▖ ▗▖
 ▐▌   ▐▌   ▐▌ ▐▌▐▌  ▐▌▐▌   ▐▌ ▐▌  ▐▌ ▐▌  █  ▐▌   ▐▌▗▞▘  ▐▛▚▖▐▌▐▌ ▐▌
  ▝▀▚▖▐▛▀▀▘▐▛▀▚▖▐▌  ▐▌▐▛▀▀▘▐▛▀▚▖  ▐▛▀▚▖  █  ▐▌   ▐▛▚▖   ▐▌ ▝▜▌▐▌ ▐▌
 ▗▄▄▞▘▐▙▄▄▖▐▌ ▐▌ ▝▚▞▘ ▐▙▄▄▖▐▌ ▐▌▗▖▐▌ ▐▌▗▄█▄▖▝▚▄▄▖▐▌ ▐▌▗▖▐▌  ▐▌▝▚▄▞▘

=> Available tasks for haos

Home Assistant OS               
  start                Start the VM
  restart              Restart the VM
  shell                Open Home Assistant OS shell
  shutdown             Stop the VM gracefully
  status               Show the status of the virtual machines
Backup                          
  backup               Create a backup of the Home Assistant OS VM
Installation                    
  create               Create the Home Assistant OS VM
  auto-start           Enable auto-start for the VM
  edit                 Edit the Home Assistant OS VM configuration
  remove               Remove the Home Assistant OS VM and disk image

Usage: ./Taskfile haos <task> <args>

Copy link
Copy Markdown
Member

@rick-nu rick-nu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAUW

@rick-nu rick-nu merged commit e82782c into production Mar 27, 2026
1 check passed
@rick-nu rick-nu deleted the subtaskfiles branch March 27, 2026 20:02
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.

2 participants