W3cubDocs

/Nushell

grid for viewers

Renders the output to a textual terminal grid.

Signature

> grid {flags}

Flags

  • --width, -w {int}: number of terminal columns wide (not output columns)
  • --color, -c: draw output with color
  • --separator, -s {string}: character to separate grid with

Input/output types:

input output
list<any> string
record string
table string

Examples

Render a simple list to a grid

> [123abc] |grid
123abc

The above example is the same as:

> [123abc] |wrapname|grid
123abc

Render a record to a grid

> {name:'foo', b:1, c:2} |grid
foo

Render a list of records to a grid

> [{name:'A', v:1} {name:'B', v:2} {name:'C', v:3}] |grid
ABC

Render a table with 'name' column in it to a grid

> [[namepatch]; [0.1.0false] [0.1.1true] [0.2.0false]] |grid
0.1.00.1.10.2.0

Notes

grid was built to give a concise gridded layout for ls. however, it determines what to put in the grid by looking for a column named 'name'. this works great for tables and records but for lists we need to do something different. such as with '[one two three] | grid' it creates a fake column called 'name' for these values so that it prints out the list properly.

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/grid.html