Skip to content

passing environment variables to task via command directly on windows #203

Description

@LittleC
  • Task version: master(installed via go)
  • OS: windows
  • Example Taskfile:
version: '2'
env:
  CONFIG: Debug
print:
    cmds:
      - echo $CONFIG

For Mac, I could pass environment variables like this CONFIG=Debug task print,
but for windows, I have to do $env:CONFIG='Debug'; task print; Remove-Item Env:\CONFIG in powershell, because task print CONFIG=Release will just parse that as vars rather than env.

I'm wondering if it is possible to provide a way to pass env variable directly in one command like
task print $CONFIG=Debug VAR=test, for which

  • variable name start with a $ will be recognized as env
  • otherwise, treated as vars like current

Or any other ideas? Open for discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions