tmp file with dynamic file handler

This shows in case you need to make filename dynamic and not hard coded, then you can use a varname for the file handler, which indirectly point to file path

Demo

source

Main task yaml file
    vars:
      my_secrete_file_reg_name: my_secret
    tasks:
    - name: task
      task:
      - func: cmd
        do:
        - name: tmpFile
          cmd:
            reg: '{{.my_secrete_file_reg_name}}'
            content: hello, world
      - func: cmd
        dvars:
        - name: filepath
          value: '{{index . .my_secrete_file_reg_name}}'
          flags:
          - v
        do:
        - name: inspect
          cmd:
          - debug_vars
        - name: readFile
          cmd:
            filename: '{{.filepath}}'
            reg: my_file_content
        - name: print
          cmd: 'file content: {{.my_file_content}}'
    
Main log file
    loading [Config]:  ./tests/functests/upconfig.yml
    Main config:
                 Version -> 1.0.0
                  RefDir -> ./tests/functests
                 WorkDir -> cwd
              AbsWorkDir -> /up_project/up
                TaskFile -> c0196
                 Verbose -> vvv
              ModuleName -> self
               ShellType -> /bin/sh
           MaxCallLayers -> 8
                 Timeout -> 3600000
     MaxModuelCallLayers -> 256
               EntryTask -> task
      ModRepoUsernameRef -> 
      ModRepoPasswordRef -> 
    work dir: /up_project/up
    -exec task: task
    loading [Task]:  ./tests/functests/c0196
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "my_secrete_file_reg_name": "my_secret",
      "up_runtime_task_layer_number": 0
    })
    
    ~SubStep1: [tmpFile:  ]
    tmp file handler: my_secret
    -Step2:
    dvar> filepath:
    "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620"
    
    -
    /tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620
    self: final context exec vars:
    
    (*core.Cache)({
      "my_secrete_file_reg_name": "my_secret",
      "my_secret": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620",
      "up_runtime_task_layer_number": 0,
      "filepath": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620"
    })
    
    ~SubStep1: [inspect:  ]
     1: inspect[debug_vars]
    -debug vars-
    "UpRunTimeVars"
    (*core.Cache)({
      "up_runtime_task_layer_number": 0
    })
    
    "RuntimeVarsAndDvarsMerged"
    (*core.Cache)({
      "my_secrete_file_reg_name": "my_secret",
      "my_secret": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620"
    })
    
    "ExecbaseVars"
    (*core.Cache)({
      "my_secrete_file_reg_name": "my_secret",
      "my_secret": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620"
    })
    
    "TaskVars"
    (*core.Cache)({
    })
    
    "ExecContextVars"
    (*core.Cache)({
      "up_runtime_task_layer_number": 0,
      "filepath": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620",
      "my_secrete_file_reg_name": "my_secret",
      "my_secret": "/tmp/BpLnfgDsc2WD8F2qNfHK5a84165634620"
    })
    
    --
    ~SubStep2: [readFile:  ]
    ~SubStep3: [print:  ]
    file content: hello, world
    
Logs with different verbose level
Raw logs with different verbose level