Skip to content

Conversation

@semihbkgr
Copy link
Contributor

@semihbkgr semihbkgr commented Dec 14, 2025

This PR exposes the state of the --yes (or -y) CLI flag as a global templating variable named .CLI_ASSUME_YES.

This allows users to conditionally execute logic in their Taskfiles based on whether the user has confirmed prompts via the CLI flag.

see: #2479

Example:

tasks:
  example:
    cmds:
      - >
        {{if .CLI_ASSUME_YES}}
        echo "Assume yes is true"
        {{else}}
        echo "Assume yes is false"
        {{end}}

Changes:

  • Added .CLI_ASSUME_YES to the global variables in cmd/task/task.go
  • Documented the new variable in website/src/docs/reference/templating.md

…vironment variable if not explicitly set via CLI.
@vmaerten vmaerten self-requested a review December 14, 2025 14:37
Copy link
Member

@vmaerten vmaerten left a comment

Choose a reason for hiding this comment

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

Hello
Thanks for your PR but this is does not adress the issue
The issue is about adding .CLI_ASSUME_YES as a global variable in the templating system

A side note, now we have a config file (taskrc), we won't add more "config env variables"

@semihbkgr
Copy link
Contributor Author

Got it, that makes more sense now. Thanks for the explanation. I was initially confused by the 'env var' terminology in the comments. I understand now that this should be a global variable exposed in the templating system. I'll update the PR accordingly.

…SK_ASSUME_YES` environment variable fallback.
@semihbkgr semihbkgr changed the title feat: add TASK_ASSUME_YES env var to skip prompts feat: expose .CLI_ASSUME_YES templating variable Dec 14, 2025
@semihbkgr semihbkgr requested a review from vmaerten December 14, 2025 18:42
Copy link
Member

@vmaerten vmaerten left a comment

Choose a reason for hiding this comment

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

Thanks!

@vmaerten vmaerten merged commit 1a190a1 into go-task:main Dec 15, 2025
13 checks passed
vmaerten added a commit that referenced this pull request Dec 15, 2025
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