github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/gen/variables/SELF_doc.yaml (about)

     1  - DocumentID: self
     2    Title: >-
     3      `SELF` (json)
     4    CategoryID: variables
     5    Summary: >-
     6      Meta information about the running scope.
     7    Description: |-
     8      `SELF` returns information about the functional scope that the code is running
     9      inside. Such as whether that functions STDOUT is a TTY, running in the
    10      background or a method.
    11  
    12      A 'scope' in Murex is a collection of code blocks to which variables and
    13      config are persistent within. In Murex, a variable declared inside an `if` or
    14      `foreach` block will be persistent outside of their blocks as long as you're
    15      still inside the same function.
    16  
    17      Please see scoping document (link below) for more information on scoping.
    18  
    19      This is a reserved variable so it cannot be changed.
    20    Examples: |-
    21      ```
    22      » function example { $SELF }
    23      » example
    24      {
    25          "Background": false,
    26          "Interactive": true,
    27          "Method": false,
    28          "Module": "murex/shell",
    29          "Not": false,
    30          "Parent": 834,
    31          "Scope": 834,
    32          "TTY": true
    33      }
    34      ```
    35    Detail: |-
    36      ### Background (bool)
    37  
    38      A boolean value to identify whether the current scope is running in the
    39      background for foreground.
    40  
    41      ### Interactive (bool)
    42  
    43      A boolean value to describe whether the current scope is running interactively
    44      or not.
    45  
    46      An interactive scope is one where the shell prompt is running _and_ the scope
    47      isn't running in the background. Shell scripts are not considered interactive
    48      terminals even though they might have interactive element in their code.
    49  
    50      ### Method (bool)
    51  
    52      A boolean value to describe whether the current scope is a method (ie being
    53      called mid-way or at the end of a pipeline).
    54  
    55      ### Module (str)
    56  
    57      This will be the module string for the current scope.
    58  
    59      ### Not (bool)
    60  
    61      A boolean value which represents whether the function was called with a bang-
    62      prefix or not.
    63  
    64      ### Parent (num)
    65  
    66      This is the function ID of the parent function that created the scope. In
    67      some instances this will be the same value as scope FID. However if in doubt
    68      then please using **Scope** instead.
    69  
    70      ### Scope (num)
    71  
    72      The scope value here returns the function ID of the top level function in the
    73      scope.
    74  
    75      ### TTY (bool)
    76  
    77      A boolean value as to whether STDOUT is a TTY (ie are we printing to the
    78      terminal (TTY) or a pipe?)
    79  
    80    Synonyms:
    81    - self
    82    - SELF
    83    Related:
    84    - json
    85    - string
    86    - function
    87    - scoping
    88    - pipeline
    89    - modules
    90    - reserved-vars
    91    - interactive-shell
    92