github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/runtime/runtime_doc.yaml (about)

     1  - DocumentID: runtime
     2    Title: >+
     3      `runtime`
     4    CategoryID: commands
     5    Summary: >-
     6      Returns runtime information on the internal state of Murex
     7    Description: |-
     8      `runtime` is a tool for querying the internal state of Murex. It's output
     9      will be JSON dumps.
    10    Usage: |-
    11      ```
    12      runtime flags -> <stdout>
    13      ```
    14  
    15      `builtins` is an alias for `runtime --builtins`:
    16  
    17      ```
    18      builtins -> <stdout>
    19      ```
    20    Examples: |-
    21      List all the builtin data-types that support WriteArray()
    22      
    23      ```
    24      » runtime --writearray
    25      [
    26          "*",
    27          "commonlog",
    28          "csexp",
    29          "hcl",
    30          "json",
    31          "jsonl",
    32          "qs",
    33          "sexp",
    34          "str",
    35          "toml",
    36          "yaml"
    37      ]
    38      ```
    39  
    40      List all the functions
    41  
    42      ```
    43      » runtime --functions -> [ agent aliases ]
    44      [
    45          {
    46              "Block": "\n    # Launch ssh-agent\n    ssh-agent -\u003e head -n2 -\u003e [ :0 ] -\u003e prefix \"export \" -\u003e source\n    ssh-add: @{g \u003c!null\u003e ~/.ssh/*.key} @{g \u003c!null\u003e ~/.ssh/*.pem}\n",
    47              "FileRef": {
    48                  "Column": 1,
    49                  "Line": 149,
    50                  "Source": {
    51                      "DateTime": "2019-07-07T14:06:11.05581+01:00",
    52                      "Filename": "/home/lau/.murex_profile",
    53                      "Module": "profile/.murex_profile"
    54                  }
    55              },
    56              "Summary": "Launch ssh-agent"
    57          },
    58          {
    59              "Block": "\n\t# Output the aliases in human readable format\n\truntime --aliases -\u003e formap name alias {\n        $name -\u003e sprintf \"%10s =\u003e ${esccli @alias}\\n\"\n\t} -\u003e cast str\n",
    60              "FileRef": {
    61                  "Column": 1,
    62                  "Line": 6,
    63                  "Source": {
    64                      "DateTime": "2019-07-07T14:06:10.886706796+01:00",
    65                      "Filename": "(builtin)",
    66                      "Module": "source/builtin"
    67                  }
    68              },
    69              "Summary": "Output the aliases in human readable format"
    70          }
    71      ]
    72      ```
    73  
    74      To get a list of every flag supported by `runtime`
    75  
    76      ```
    77      » runtime --help
    78      [
    79          "--aliases",
    80          "--config",
    81          "--debug",
    82          "--events",
    83          "--fids",
    84          "--flags",
    85          "--functions",
    86          "--help",
    87          "--indexes",
    88          "--marshallers",
    89          "--memstats",
    90          "--modules",
    91          "--named-pipes",
    92          "--open-agents",
    93          "--pipes",
    94          "--privates",
    95          "--readarray",
    96          "--readmap",
    97          "--sources",
    98          "--test-results",
    99          "--tests",
   100          "--unmarshallers",
   101          "--variables",
   102          "--writearray"
   103      ]
   104      ```
   105  
   106      Please also note that you can supply more than one flag. However when you
   107      do use multiple flags the top level of the JSON output will be a map of the
   108      flag names. eg
   109  
   110      ```
   111      » runtime --pipes --tests
   112      {
   113          "pipes": [
   114              "file",
   115              "std",
   116              "tcp-dial",
   117              "tcp-listen",
   118              "udp-dial",
   119              "udp-listen"
   120          ],
   121          "tests": {
   122              "state": {},
   123              "test": []
   124          }
   125      }
   126  
   127      » runtime --pipes
   128      [
   129          "file",
   130          "std",
   131          "tcp-dial",
   132          "tcp-listen",
   133          "udp-dial",
   134          "udp-listen"
   135      ]
   136  
   137      » runtime --tests
   138      {
   139          "state": {},
   140          "test": []
   141      }
   142      ```
   143    Flags:
   144      --variables: >-
   145        Lists all local Murex variables which doesn't include environmental nor
   146        global variables
   147      --globals: >-
   148        Lists all global variables
   149      --exports: >-
   150        Outputs environmental variables. For Murex variables (`global` and
   151        `set`/`let`) use `--variables`
   152      --aliases: >-
   153        Lists all aliases
   154      --builtins: >-
   155        Lists all builtin commands, compiled into Murex
   156      --methods: >-
   157        Lists all commands with a defined STDOUT and STDIN data type. This is used to
   158        generate smarter autocompletion suggestions with `->`
   159      --config: >-
   160        Lists all properties available to `config`
   161      --named-pipes: >-
   162        Lists all named pipes defined
   163      --pipes: >-
   164        Lists builtin pipes compiled into Murex. These can be then be defined as
   165        named-pipes
   166      --functions: >-
   167        Lists all Murex global functions
   168      --privates: >-
   169        Lists all Murex private functions
   170      --open-agents: >-
   171        Lists all registered `open` handlers 
   172      --fids: >-
   173        Lists all running processes / functions
   174      --readarray: >-
   175        Lists all builtin data-types which support ReadArray()
   176      --readarraywithtype: >-
   177        Lists all builtin data-types which support ReadArrayWithType()
   178      --writearray: >-
   179        Lists all builtin data-types which support WriteArray()
   180      --readmap: >-
   181        Lists all builtin data-types which support ReadMap()
   182      --indexes: >-
   183        Lists all builtin data-types which are supported by index (`[`)
   184      --not-indexes: >-
   185        Lists all builtin data-types which are supported by index (`![`)
   186      --marshallers: >-
   187        Lists all builtin data-types with marshallers (eg required for `format`)
   188      --unmarshallers: >-
   189        Lists all builtin data-types with unmarshallers (eg required for `format`)
   190      --events: >-
   191        Lists all builtin event types and any defined events
   192      --autocomplete: >-
   193        Lists all `autocomplete` schemas - both user defined and automatically
   194        generated one
   195      --memstats: >-
   196        Outputs the running state of Go's runtime
   197      --tests: >-
   198        Lists defined tests
   199      --test-results: >-
   200        A dump of any unreported test results
   201      --modules: >-
   202        Lists all installed modules
   203      --debug: >-
   204        Outputs the state of debug and inspect mode
   205      --sources: >-
   206        Lists all loaded murex sources
   207      --summaries: >-
   208        Outputs all the override summaries 
   209      --help: >-
   210        Outputs a list of `runtimes`'s flags
   211  
   212    Detail: |-
   213      ### Usage in scripts
   214  
   215      `runtime` should not be used in scripts because the output of `runtime` may
   216      be subject to change as and when the internal mechanics of Murex change.
   217      The purpose behind `runtime` is not to provide an API but rather to provide
   218      a verbose "dump" of the internal running state of Murex.
   219  
   220      If you require a stable API to script against then please use the respective
   221      command line tool. For example `fid-list` instead of `runtime --fids`. Some
   222      tools will provide a human readable output when STDOUT is a TTY but output
   223      a script parsable version when STDOUT is not a terminal.
   224  
   225      ```
   226      » fid-list
   227          FID   Parent    Scope  State         Run Mode  BG   Out Pipe    Err Pipe    Command     Parameters
   228            0        0        0  Executing     Shell     no                           -murex
   229       265499        0        0  Executing     Normal    no   out         err         fid-list
   230      
   231      » fid-list -> pretty
   232      [
   233          {
   234              "FID": 0,
   235              "Parent": 0,
   236              "Scope": 0,
   237              "State": "Executing",
   238              "Run Mode": "Shell",
   239              "BG": false,
   240              "Out Pipe": "",
   241              "Err Pipe": "",
   242              "Command": "-murex",
   243              "Parameters": ""
   244          },
   245          {
   246              "FID": 265540,
   247              "Parent": 0,
   248              "Scope": 0,
   249              "State": "Executing",
   250              "Run Mode": "Normal",
   251              "BG": false,
   252              "Out Pipe": "out",
   253              "Err Pipe": "err",
   254              "Command": "fid-list",
   255              "Parameters": ""
   256          },
   257          {
   258              "FID": 265541,
   259              "Parent": 0,
   260              "Scope": 0,
   261              "State": "Executing",
   262              "Run Mode": "Normal",
   263              "BG": false,
   264              "Out Pipe": "out",
   265              "Err Pipe": "err",
   266              "Command": "pretty",
   267              "Parameters": ""
   268          }
   269      ]
   270      ```
   271      
   272      ### File reference
   273  
   274      Some of the JSON dumps produced from `runtime` will include a map called
   275      `FileRef`. This is a trace of the source file that defined it. It is used
   276      by Murex to help provide meaningful errors (eg with line and character
   277      positions) however it is also useful for manually debugging user-defined
   278      properties such as which module or script defined an `autocomplete` schema.
   279      
   280      ### Debug mode
   281  
   282      When `debug` is enabled garbage collection is disabled for variables and
   283      FIDs. This means the output of `runtime --variables` and `runtime --fids`
   284      will contain more than just the currently defined variables and running
   285      functions.
   286    Synonyms:
   287      - runtime
   288      - builtins
   289    Related:
   290    - set
   291    - let
   292    - export
   293    - global
   294    - config
   295    - pipe
   296    - function
   297    - private
   298    - fid-list
   299    - foreach
   300    - formap
   301    - item-index
   302    - format
   303    - event
   304    - autocomplete
   305    - test
   306    - debug
   307    - source
   308    - pretty
   309    - open
   310    - openagent
   311    - method
   312  
   313