Skip to content

variables not overriding. #2252

@joeblew999

Description

@joeblew999

Going batty trying to get consistent behaviour...

I expected to get HTML_DEEP_PATH with test1 in it, from the .env, but nope :)

Would appreciate advice on what I am missing...

If I move the 3 variables into the var: area it blows up also.

run.env

HTML_DEEP_PATH={{.PWD}}/test1
HTML_DEEP_NAME=name
HTML_DEEP_WHICH={{.HTML_DEEP_PATH}}/{{.HTML_DEEP_NAME}}

taskfile.yml:

# yaml-language-server: $schema=https://taskfile.dev/schema.json

version: '3'

# MUST have this ONLY in root for env variables to work.
dotenv: ['run.env', '{{.ENV}}/.env', '{{.HOME}}/.env']


env:

  HTML_DEEP_PATH: '{{.HTML_DEEP_PATH | default "{{.PWD}}" }}'
  HTML_DEEP_NAME: '{{.HTML_DEEP_NAME | default "test.html" }}'
  
  HTML_DEEP_WHICH: '{{.HTML_DEEP_PATH}}/{{.HTML_DEEP_NAME}}'

var:



tasks:
  default:
    cmds:
      - echo ''
      - echo HTML_DEEP_PATH              {{shellQuote .HTML_DEEP_PATH}}
      - echo HTML_DEEP_NAME              {{.HTML_DEEP_NAME}}
      - echo HTML_DEEP_WHICH             {{shellQuote .HTML_DEEP_WHICH}}
      - echo ''
    silent: true

  

run it:


task

HTML_DEEP_PATH {{.PWD}}
HTML_DEEP_NAME test.html
HTML_DEEP_WHICH {{.PWD}}/test.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions