github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/expressions/testcode/testcode_ac_index.mx (about)

     1  autocomplete: set "[" { [{
     2      "AnyValue": true,
     3      "AllowMultiple": true,
     4      "ExecCmdline": true,
     5      "Dynamic": ({
     6          switch ${ get-type: stdin } {
     7              case * {
     8                  #<stdin> -> tabulate -> [ 0: ] -> format json -> [ 0 ]
     9                  <stdin> -> [ 0: ] -> format json -> [ 0 ] -> append "]"
    10              }
    11  
    12              case csv {
    13                  <stdin> -> [ 0: ] -> format json -> [ 0 ] -> append "]"
    14              }
    15              
    16              case jsonl {
    17                  <stdin> -> [ 0 ] -> set header
    18                  $header -> cast utf8 -> [ 0 -1 ] -> set jsonl_format
    19                  if { = jsonl_format==`[]` } then {
    20                      tout json $header -> append "]"
    21                  }
    22              }
    23  
    24              catch {
    25                  <stdin> -> formap k v { out $k } -> cast str -> append "]"
    26              }
    27          }
    28      })
    29  }] }