else branch

Introduce the else element, with an array of tasks for detailed implementations

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
        desc: show example the route goes to call goelse for the condition of not if condition
          succeeds
        do:
        - goahead
        if: '{{.goahead}}'
        else: goelse
      - func: call
        desc: show example the else coud route to call a list of tasks
        do:
        - goahead
        if: '{{.goahead}}'
        else:
        - goelse
        - goelse
        - goelse2
        - goelse2
      - func: call
        desc: show it is same that you could assemble a list of tasks for if true condition
        vars:
          goahead: True
        do:
        - goahead
        - goahead
        - goahead
        if: '{{.goahead}}'
        else:
        - goelse
        - goelse
        - goelse2
        - goelse2
    - name: goahead
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'go ahead .......'
    - name: goelse
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'do something else .......'
    - name: goelse2
      task:
      - func: cmd
        do:
        - name: print
          cmd: 'do something else2 .......'
    
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 -> c0127
                 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/c0127
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 0,
      "goahead": false
    })
    
    ~SubStep1: [print:  ]
    true/false value of goahead:
    false
    true
    
    -Step2: [: show example the route goes to call goelse for the condition of not if condition succeeds ]
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 0
    })
    
    =Task3: [task ==> goelse:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [print:  ]
    do something else .......
    -Step3: [: show example the else coud route to call a list of tasks ]
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 1
    })
    
    =Task3: [task ==> goelse:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": false
    })
    
    ~~SubStep1: [print:  ]
    do something else .......
    =Task3: [task ==> goelse:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": false,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [print:  ]
    do something else .......
    =Task4: [task ==> goelse2:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": false
    })
    
    ~~SubStep1: [print:  ]
    do something else2 .......
    =Task4: [task ==> goelse2:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": false
    })
    
    ~~SubStep1: [print:  ]
    do something else2 .......
    -Step4: [: show it is same that you could assemble a list of tasks for if true condition ]
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": true
    })
    
    =Task2: [task ==> goahead:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "up_runtime_task_layer_number": 1,
      "goahead": true
    })
    
    ~~SubStep1: [print:  ]
    go ahead .......
    =Task2: [task ==> goahead:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": true,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [print:  ]
    go ahead .......
    =Task2: [task ==> goahead:  ]
    --Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "goahead": true,
      "up_runtime_task_layer_number": 1
    })
    
    ~~SubStep1: [print:  ]
    go ahead .......
    
Logs with different verbose level
Raw logs with different verbose level