Skip to content

Conversation

@mattn
Copy link
Contributor

@mattn mattn commented Dec 13, 2025

Many users prefer the .yaml extension over .yml for YAML files, as it's more explicit and commonly used in various tools and editors (e.g., for better syntax highlighting or consistency with other projects).

Currently, running task --init (or task -i) always creates a file named Taskfile.yml, which requires manual renaming for those who prefer Taskfile.yaml.

This PR introduces a new environment variable, TASKFILE_DEFAULT_NAME, that allows users to override the default filename generated by task --init.

  • If TASKFILE_DEFAULT_NAME is set (e.g., TASKFILE_DEFAULT_NAME=Taskfile.yaml task --init), the init command will create the file with that exact name.
  • The path handling remains the same: if a directory is provided, the custom name will be used inside it; otherwise, it creates the file in the current directory.
  • If the variable is not set, behavior remains unchanged (defaults to Taskfile.yml).
  • Validation ensures the provided name includes a supported extension (.yml or .yaml) to avoid confusion.

This change provides more flexibility for users without altering the default experience or affecting existing Taskfiles. It addresses community feedback around filename preferences (related to discussions in issues like #2008 and historical PRs for .yaml support) in a non-breaking way.

No changes to Taskfile detection/loading logic are made—only the init-generated filename is customizable.

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