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

     1  if { which yarn } then {
     2      autocomplete: <!null> set yarn ({[
     3          {
     4              "CacheTTL": 30,
     5              "Dynamic": ({
     6                  g: ${yarn <!null> bin}/* -> regexp: s,^.*/,,
     7              }),
     8              "FlagsDesc": ${
     9                  trypipe <!null> {
    10                      yarn help -> tabulate: --key-value --split-comma --key-inc-hint --map
    11                  }
    12              },
    13              "Optional": true,
    14              "AllowMultiple": true,
    15              "AllowNoFlagValue": true,
    16              "FlagValues": {"*": [
    17                  { "IncDirs": true },
    18                  { "Goto": "/0" }
    19              ]}
    20          },
    21          {
    22              "DynamicDesc": ({
    23                  cast json
    24                  if { g: package.json } then {
    25                      open package.json -> [ scripts ]
    26                  }
    27              }),
    28              "Optional": true
    29          },
    30          {
    31              "Flags": ${
    32                  trypipe <!null> {
    33                      yarn help -> @[Commands..Run]re -> [:1] -> cast str -> format json
    34                  }
    35              },
    36              "FlagValues": {
    37                  ${
    38                      trypipe <!null> {
    39                          yarn help -> @[Commands..Run]re -> [:1] -> foreach cmd {
    40                              out ("$cmd":
    41                                  [{
    42                                      "DynamicDesc": ({ 
    43                                          yarn help $cmd -> tabulate: --key-value --split-comma --key-inc-hint --map
    44                                      }),
    45                                      "AllowMultiple": true,
    46                                      "AllowNoFlagValue": true,
    47                                      "FlagValues": {"*": [
    48                                          { "IncDirs": true },
    49                                          { "Goto": "/2/add/0" }
    50                                      ]}
    51                                  }],)
    52                          }
    53                      }
    54                  }
    55                  "": [{ }]
    56              }
    57          }
    58      ]})
    59  }