Add support for customizing default Taskfile name via TASKFILE_DEFAULT_NAME environment variable#2575
Add support for customizing default Taskfile name via TASKFILE_DEFAULT_NAME environment variable#2575mattn wants to merge 3 commits intogo-task:mainfrom
Conversation
|
@mattn would this be better as an item in the Task configuration file? |
|
@trulede I think the configuration file extension should be |
|
@mattn that part is fine. The question is about the mechanism you have chosen, and if using the taskrc.yml configuration file might be a better option ... on the basis that envars are good for changing behaviour from run to run, but longer term adjustments fit better to the configuration file (taskrc.yml) approach. |
|
Ah, so you're saying that instead of environment variables, you can reference a BTW, can we handle |
|
@mattn there has been a recent change to the operation of the init command option. You can do this:
Perhaps you are happy with that? And there is nothing more to do with this PR? |
Many users prefer the
.yamlextension over.ymlfor 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(ortask -i) always creates a file namedTaskfile.yml, which requires manual renaming for those who preferTaskfile.yaml.This PR introduces a new environment variable,
TASKFILE_DEFAULT_NAME, that allows users to override the default filename generated bytask --init.TASKFILE_DEFAULT_NAMEis set (e.g.,TASKFILE_DEFAULT_NAME=Taskfile.yaml task --init), the init command will create the file with that exact name.Taskfile.yml)..ymlor.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
.yamlsupport) in a non-breaking way.No changes to Taskfile detection/loading logic are made—only the init-generated filename is customizable.