input
for platform
Get input from the user.
Signature
> input {flags} (prompt)
Flags
--bytes-until-any, -u {string}
: read bytes (not text) until any of the given stop bytes is seen--numchar, -n {int}
: number of characters to read; suppresses output--default, -d {string}
: default value if no input is provided--reedline
: use the reedline library, defaults to false--history-file {path}
: Path to a file to read and write command history. This is a text file and will be created if it doesn't exist. Will be used as the selection list.--max-history {int}
: The maximum number of entries to keep in the history, defaults to $env.config.history.max_size.--suppress-output, -s
: don't print keystroke values
Parameters
prompt
: Prompt to show the user.
Input/output types:
input | output |
---|---|
nothing | any |
list<string> | any |
Examples
Get input from the user, and assign to a variable
> let user_input = (input)
Get two characters from the user, and assign to a variable
> let user_input = (input --numchar 2)
Get input from the user with default value, and assign to a variable
> let user_input = (input --default 10)
Get input from the user with history, and assign to a variable
> let user_input = ([past,command,entries] | input )
Get input from the user with history backed by a file, and assign to a variable
> let user_input = (input --history-file ./history.txt)
Subcommands:
name | description | type |
---|---|---|
input list | Interactive list selection. | built-in |
input listen | Listen for user interface event. | built-in |