type compare

Showcase how to get the type of data object

Demo

source

Main task yaml file
    tasks:
    - name: task
      task:
      - func: cmd
        vars:
          my_friend: joe doe
          who_is_trusted: my_friend
          friends:
          - tom
          - jane
          - hans
          - coook
        dvars:
        - name: countries
          value: |
            - Austraila
            - US
            - China
            - Japan
          flag:
          - toObj
          - keepName
          - v
        do:
        - name: print
          cmd: '{{.countries}}'
        - name: typeOf
          cmd:
          - 'countries'
          - 'friends'
          - my_friend
          - '{{.who_is_trusted}}'
        - name: print
          cmd: |
            type of countries: {{.countries | typeOf}}
            type of friends: {{.friends | typeOf}}
            type of my_friends: {{.my_friend | typeOf}}
            who is trusted: {{.who_is_trusted |typeOf}}
      - func: cmd
        vars:
          my_friend: john
        do:
        - name: print
          cmd: 'hello: {{.my_friend}}'
        if: '{{.my_friend |typeIs "string"}}'
    
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 -> c0162
                 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/c0162
    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,
      "friends": {
        "tom",
        "jane",
        "hans",
        "coook"
      },
      "my_friend": "joe doe",
      "who_is_trusted": "my_friend",
      "countries": "- Austraila\n- US\n- China\n- Japan\n"
    })
    
    ~SubStep1: [print:  ]
    - Austraila
    - US
    - China
    - Japan
    
    ~SubStep2: [typeOf:  ]
     1 -  type of [countries] > [string]
     2 -  type of [friends] > [[]interface {}]
     3 -  type of [my_friend] > [string]
     4 -  type of [my_friend] > [string]
    ~SubStep3: [print:  ]
    type of countries: string
    type of friends: []interface {}
    type of my_friends: string
    who is trusted: string
    
    -Step2:
    self: final context exec vars:
    
    (*core.Cache)({
      "my_friend": "john",
      "up_runtime_task_layer_number": 0
    })
    
    ~SubStep1: [print:  ]
    hello: john
    
Logs with different verbose level
Raw logs with different verbose level