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

     1  - DocumentID: namedpipe
     2    Title: >+
     3      `<read-named-pipe>`
     4    CategoryID: parser
     5    Summary: >-
     6      Reads from a Murex named pipe
     7    Description: |-
     8      Sometimes you will need to start a command line with a Murex named pipe, eg
     9  
    10      ```
    11      » <namedpipe> -> match foobar
    12      ```
    13  
    14      > See the documentation on `pipe` for more details about Murex named pipes.
    15    Usage: |-
    16      Read from pipe
    17  
    18      ```
    19      <namedpipe> -> <stdout>
    20      ```
    21  
    22      Write to pipe
    23  
    24      ```
    25      <stdin> -> <namedpipe>
    26      ```
    27    Examples: |-
    28      The follow two examples function the same
    29  
    30      ```
    31      » pipe example
    32      » bg { <example> -> match 2 }
    33      » a <example> [1..3]
    34      2
    35      » !pipe example
    36      ```
    37    Flags:
    38    Detail: |-
    39      {{ include "gen/includes/named-pipes.inc.md" }}
    40    Synonyms:
    41      - "(murex named pipe)"
    42      - "<>"
    43      - read-named-pipe
    44    Related:
    45      - pipe
    46      - stdin
    47      - bg
    48      - a
    49      - ja
    50      - runtime
    51  
    52  - DocumentID: stdin
    53    Title: >+
    54      `<stdin>`
    55    CategoryID: commands
    56    Summary: >-
    57      Read the STDIN belonging to the parent code block
    58    Description: |-
    59      This is used inside functions and other code blocks to pass that block's
    60      STDIN down a pipeline
    61    Usage: |-
    62      ```
    63      <stdin> -> <stdout>
    64      ```
    65    Examples: |-
    66      When writing more complex scripts, you cannot always invoke your read as the
    67      first command in a code block. For example a simple pipeline might be:
    68  
    69      ```
    70      » function example { -> match 2 }
    71      ```
    72  
    73      But this only works if `->` is the very first command. The following would
    74      fail:
    75  
    76      ```
    77      # Incorrect code
    78      function example {
    79          out "only match 2"
    80          -> match 2
    81      }
    82      ```
    83  
    84      This is where `<stdin>` comes to our rescue:
    85  
    86      ```
    87      function example {
    88          out "only match 2"
    89          <stdin> -> match 2
    90      }
    91      ```
    92  
    93      This could also be written as:
    94  
    95      ```
    96      function example { out "only match 2"; <stdin> -> match 2 }
    97      ```
    98    Flags:
    99    Detail: |-
   100      `<stdin>` makes use of a feature called **named pipes**, which are a way of
   101      piping data between processes without chaining them together as a single
   102      command pipeline (eg commands delimited with `|`, `->`, `=>`, `?` tokens).
   103  
   104      {{ include "gen/includes/named-pipes.inc.md" }}
   105    Synonyms:
   106      - "<stdin>"
   107    Related:
   108      - pipe
   109      - namedpipe
   110      - out
   111      - function
   112      - match
   113      - runtime
   114      - pipeline