print message

cmd func is a core func to wrap up some actions, for example, query yml string/object, register/deRegister a var, exit the task, template etc. It focus on core functionalities implementation provided by UP cmd cli internals

The print cmd simply print out the message, either it is a raw message, or a templated message referencing to vars. This is normally used for tracing and debugging

Demo

source

Main task yaml file
    vars:
      student:
        name: Tom
        gender: Male
        school: Sydney Grammar
    tasks:
    - name: task
      task:
      - func: shell
        do:
        - echo "hello 1"
      - func: cmd
        do:
        - name: print
          desc: print some info
          cmd: "hello, this is print commmand"
        - name: print
          cmd: "hello, {{.student.school}}"
        - name: print
          cmd: |
            hello, {{.student.school}}
            hello, {{.student.school}}
    
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 -> c0064
                 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/c0064
    module: [self], instance id: [dev], exec profile: []
    profile -  envVars:
    
    (*core.Cache)({
    })
    
    Task1: [task ==> task:  ]
    -Step1:
    self: final context exec vars:
    
    (*core.Cache)({
      "student": {
        "name": "Tom",
        "gender": "Male",
        "school": "Sydney Grammar"
      },
      "up_runtime_task_layer_number": 0
    })
    
    cmd( 1):
    echo "hello 1"
    
    -
    hello 1
    
    -
     .. ok
    . ok
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "student": {
        "gender": "Male",
        "school": "Sydney Grammar",
        "name": "Tom"
      },
      "last_result": (*utils.ExecResult)({
        Cmd: "echo \"hello 1\"",
        Code: 0,
        Output: "hello 1",
        ErrMsg: ""
      }),
      "up_runtime_task_layer_number": 0
    })
    
    ~SubStep1: [print: print some info ]
    hello, this is print commmand
    ~SubStep2: [print:  ]
    hello, Sydney Grammar
    ~SubStep3: [print:  ]
    hello, Sydney Grammar
    hello, Sydney Grammar
    
    
Logs with different verbose level
Raw logs with different verbose level