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

term query for platform

Query the terminal for information.

Signature

> term query {flags} (query)

Flags

  • --prefix, -p {oneof<binary, string>}: Prefix sequence for the expected reply.
  • --terminator, -t {oneof<binary, string>}: Terminator sequence for the expected reply.
  • --keep, -k: Include prefix and terminator in the output.

Parameters

  • query: The query that will be printed to stdout.

Input/output types:

inputoutput
nothingbinary

Examples

Get cursor position.

> term query (ansi cursor_position) --prefix (ansi csi) --terminator 'R'

Get terminal background color.

> term query $'(ansi osc)10;?(ansi st)' --prefix $'(ansi osc)10;' --terminator (ansi st)

Get terminal background color. (some terminals prefer char bel rather than ansi st as string terminator)

> term query $'(ansi osc)10;?(char bel)' --prefix $'(ansi osc)10;' --terminator (char bel)

Read clipboard content on terminals supporting OSC-52.

> term query $'(ansi osc)52;c;?(ansi st)' --prefix $'(ansi osc)52;c;' --terminator (ansi st)

Notes

Print the given query, and read the immediate result from stdin.

The standard input will be read right after query is printed, and consumed until the terminator sequence is encountered. The terminator is not included in the output.

If terminator is not supplied, input will be read until Ctrl-C is pressed.

If prefix is supplied, input's initial bytes will be validated against it. The prefix is not included in the output.