Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
nothingany
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:

namedescriptiontype
input listInteractive list selection.built-in
input listenListen for user interface event.built-in