github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/tread.md (about)

     1  # `tread`
     2  
     3  > `read` a line of input from the user and store as a user defined *typed* variable (deprecated)
     4  
     5  ## Description
     6  
     7  A readline function to allow a line of data inputted from the terminal and then
     8  store that as a typed variable.
     9  
    10  **This builtin is now deprecated. Please use `read --datatype ...` instead**
    11  
    12  ## Usage
    13  
    14  ```
    15  tread data-type "prompt" var_name
    16  
    17  <stdin> -> tread data-type var_name
    18  ```
    19  
    20  ## Examples
    21  
    22  ```
    23  tread qs "Please paste a URL: " url
    24  out "The query string values included were:"
    25  $url -> format json
    26  
    27  out Please paste a URL: -> tread qs url
    28  out "The query string values included were:"
    29  $url -> format json
    30  ```
    31  
    32  ## Detail
    33  
    34  If `tread` is called as a method then the prompt string is taken from STDIN.
    35  Otherwise the prompt string will be the first parameter. However if no prompt
    36  string is given then `tread` will not write a prompt.
    37  
    38  The last parameter will be the variable name to store the string read by `tread`.
    39  This variable cannot be prefixed by dollar, `$`, otherwise the shell will write
    40  the output of that variable as the last parameter rather than the name of the
    41  variable.
    42  
    43  ## See Also
    44  
    45  * [`%(Brace Quote)`](../parser/brace-quote.md):
    46    Initiates or terminates a string (variables expanded)
    47  * [`cast`](../commands/cast.md):
    48    Alters the data type of the previous function without altering it's output
    49  * [`err`](../commands/err.md):
    50    Print a line to the STDERR
    51  * [`format`](../commands/format.md):
    52    Reformat one data-type into another data-type
    53  * [`out`](../commands/out.md):
    54    Print a string to the STDOUT with a trailing new line character
    55  * [`pretty`](../commands/pretty.md):
    56    Prettifies JSON to make it human readable
    57  * [`read`](../commands/read.md):
    58    `read` a line of input from the user and store as a variable
    59  * [`tout`](../commands/tout.md):
    60    Print a string to the STDOUT and set it's data-type
    61  
    62  <hr/>
    63  
    64  This document was generated from [builtins/core/io/read_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/io/read_doc.yaml).