Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove task env if empty/null #1426

Open
lucasfcnunes opened this issue Dec 13, 2023 · 0 comments
Open

Remove task env if empty/null #1426

lucasfcnunes opened this issue Dec 13, 2023 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@lucasfcnunes
Copy link
Contributor

Description

Empty env in task should override global env unsetting it instead of making it empty text.

Cases

Taskfile.yaml

version: '3'
env:
  CASE_1: GO-TASK
tasks:
  1.a:
    env:
      CASE_1:
    cmds:
      - defer: env | grep CASE_1=
  1.b:
    env:
      CASE_1:
    cmds:
      - defer: unset CASE_1 && env | grep CASE_1=
  2:
    env:
      CASE_2:
    cmds:
      - defer: env | grep CASE_2=
  3:
    env:
      CASE_3: null
    cmds:
      - defer: env | grep CASE_3=
  4:
    env:
      CASE_4: ''
    cmds:
      - defer: env | grep CASE_4=
  5:
    cmds:
      - defer: env | grep CASE_5=

Results

$ task 1.a 1.b 2 3 4 5
task: [1.a] env | grep CASE_1=
CASE_1=
task: [1.b] unset CASE_1 && env | grep CASE_1=
task: [2] env | grep CASE_2=
CASE_2=
task: [3] env | grep CASE_3=
CASE_3=
task: [4] env | grep CASE_4=
CASE_4=
task: [5] env | grep CASE_5=

Proposal

  • empty text ('') => set, 'CASE_X=' (like 1.a, 2, 3, 4)
  • empty = null (in yaml) => unset, no CASE_X (like 1.b, 5)
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants