Skip to content

Latest commit

 

History

History
113 lines (90 loc) · 2.11 KB

append.md

File metadata and controls

113 lines (90 loc) · 2.11 KB
title categories version filters usage
append
filters
0.86.0
Append any number of rows to a table.
Append any number of rows to a table.

{{ $frontmatter.title }} for filters

{{ $frontmatter.filters }}

Signature

> append {flags} (row)

Parameters

  • row: the row, list, or table to append

Input/output types:

input output
any list<any>

Examples

Append one int to a list

> [0 1 2 3] | append 4
╭───┬───╮
│ 00 │
│ 11 │
│ 22 │
│ 33 │
│ 44 │
╰───┴───╯

Append a list to an item

> 0 | append [1 2 3]
╭───┬───╮
│ 00 │
│ 11 │
│ 22 │
│ 33 │
╰───┴───╯

Append a list of string to a string

> "a" | append ["b"]
╭───┬───╮
│ 0 │ a │
│ 1 │ b │
╰───┴───╯

Append three int items

> [0 1] | append [2 3 4]
╭───┬───╮
│ 00 │
│ 11 │
│ 22 │
│ 33 │
│ 44 │
╰───┴───╯

Append ints and strings

> [0 1] | append [2 nu 4 shell]
╭───┬───────╮
│ 00 │
│ 11 │
│ 22 │
│ 3 │ nu    │
│ 44 │
│ 5 │ shell │
╰───┴───────╯

Append a range of ints to a list

> [0 1] | append 2..4
╭───┬───╮
│ 00 │
│ 11 │
│ 22 │
│ 33 │
│ 44 │
╰───┴───╯

Notes

Be aware that this command 'unwraps' lists passed to it. So, if you pass a variable to it, and you want the variable's contents to be appended without being unwrapped, it's wise to pre-emptively wrap the variable in a list, like so: append [$val]. This way, append will only unwrap the outer list, and leave the variable's contents untouched.