github.com/coveo/gotemplate@v2.7.7+incompatible/docs/doc_test/os-commands.rendered (about)

     1  {% include navigation.html %}
     2  {% raw %}
     3  
     4  # OS commands
     5  
     6  It is possible to run OS commands using the following go template functions:
     7  
     8  * `exec` returns the result of a shell command as structured data.
     9  * `run` returns the result of a shell command as a string.
    10  
    11  ## exec
    12  
    13  ### Razor
    14  ```
    15  First result: test2
    16  Second result: test3
    17  SomeData: test2
    18  SomeData2: test3
    19  
    20  Should be `string`: string
    21  Test
    22  ```
    23  
    24  ### Gotemplate
    25  ```
    26  First result: test2
    27  Second result: test3
    28  SomeData: test2
    29  SomeData2: test3
    30  
    31  Should be `string`: string
    32  Test
    33  ```
    34  
    35  ### Result
    36  ```
    37  First result: test2
    38  Second result: test3
    39  SomeData: test2
    40  SomeData2: test3
    41  
    42  Should be `string`: string
    43  Test
    44  ```
    45  
    46  ## run
    47  
    48  ### Razor
    49  ```
    50  Should be `string`: string
    51  SomeData: test2
    52  SomeData2: test3
    53  ```
    54  
    55  ### Gotemplate
    56  ```
    57  Should be `string`: string
    58  SomeData: test2
    59  SomeData2: test3
    60  ```
    61  
    62  ### Result
    63  ```
    64  Should be `string`: string
    65  SomeData: test2
    66  SomeData2: test3
    67  ```
    68  
    69  
    70  {% endraw %}