github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0162.yml (about)

     1  doc_meta: |
     2    folder: template
     3    title: type compare
     4    head: |
     5      Showcase how to get the type of data object
     6  
     7    sections:
     8  
     9      - title: Demo
    10        log: yes
    11  
    12  tasks:
    13    -
    14      name: task
    15      task:
    16        -
    17          func: cmd
    18          vars:
    19            my_friend: joe doe
    20            who_is_trusted: my_friend
    21            friends:
    22              - tom
    23              - jane
    24              - hans
    25              - coook
    26  
    27          dvars:
    28            - name: countries
    29              value: |
    30                - Austraila
    31                - US
    32                - China
    33                - Japan
    34              flag:
    35                - toObj
    36                - keepName
    37                - v
    38          do:
    39            - name: print
    40              cmd: '{{.countries}}'
    41            - name: typeOf
    42              cmd:
    43                - 'countries'
    44                - 'friends'
    45                - my_friend
    46                - '{{.who_is_trusted}}'
    47  
    48            - name: print
    49              cmd: |
    50                type of countries: {{.countries | typeOf}}
    51                type of friends: {{.friends | typeOf}}
    52                type of my_friends: {{.my_friend | typeOf}}
    53                who is trusted: {{.who_is_trusted |typeOf}}
    54  
    55        -
    56          func: cmd
    57          vars:
    58            my_friend: john
    59          do:
    60            - name: print
    61              cmd: 'hello: {{.my_friend}}'
    62          if: '{{.my_friend |typeIs "string"}}'
    63