From 8eb76f911c5d4e269f894a1e987c58f33146ab2d Mon Sep 17 00:00:00 2001 From: AlifianK <50392169+AlifianK@users.noreply.github.com> Date: Wed, 2 Oct 2024 00:29:31 +0700 Subject: [PATCH] Document `wrap` behavior with index --- commands/docs/wrap.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/commands/docs/wrap.md b/commands/docs/wrap.md index 62e84dae01f..cd37fe8e6b5 100644 --- a/commands/docs/wrap.md +++ b/commands/docs/wrap.md @@ -57,3 +57,20 @@ Wrap a range into a table with a given column name ╰───┴─────╯ ``` + +## Notes +Since `index` is a special keyword that defines the index of the table itself, in this case, `wrap` behavior might be surprising to some. +```nu +> [4 5 6] | wrap index +╭───┬───────────────╮ +│ 4 │ ╭───────┬───╮ │ +│ │ │ index │ 4 │ │ +│ │ ╰───────┴───╯ │ +│ 5 │ ╭───────┬───╮ │ +│ │ │ index │ 5 │ │ +│ │ ╰───────┴───╯ │ +│ 6 │ ╭───────┬───╮ │ +│ │ │ index │ 6 │ │ +│ │ ╰───────┴───╯ │ +╰───┴───────────────╯ +```