else in hard way

Try to implement the else logic using if condition

It works but it is not dry

Demo

source

Main task yaml file
    vars:
      goahead: False
    #  goahead: True
    
    tasks:
    - name: task
      task:
      - func: cmd
        do:
        - name: print
          cmd: |
            true/false value of goahead:
            {{.goahead}}
            {{not .goahead}}
      - func: call
        do:
        - goahead
        if: '{{.goahead}}'
      - func: call
        do:
        - else
        if: '{{not .goahead}}'
    - name: goahead
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'go ahead .......'
    - name: else
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'do something else .......'
    
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 -> c0126
                 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/c0126
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 0
    })
    
    ~SubStep1: [print:  ]
    true/false value of goahead:
    false
    true
    
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 0
    })
    
    condition failed, skip executing step 
    
    -Step3:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 0
    })
    
    =Task3: [task ==> else:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": false
    })
    
    ~~SubStep1: [print:  ]
    do something else .......
    
Logs with different verbose level
Raw logs with different verbose level