Files
dotfiles/dot_config/nushell/nu_scripts/stdlib-candidate/std-rfc/tables/select-ranges.nu
Cian Hughes 896af887ca Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
2024-11-07 13:52:17 +00:00

27 lines
561 B
Nu

use ./row-indices.nu *
# Selects one or more rows while keeping
# the original indices.
#
# Example - Selects the first, fifth, and
# sixth rows from the table:
#
# ls / | select ranges 0 4..5
#
# Example - Select the 5th row:
#
# ls / | select 5
#
# Example - Select the 4th row.
# Note that the difference beteen this
# and `select 3` is that the index (#)
# column shows the *original* (pre-select)
# position in the table.
#
# ls | select ranges 3
export def "select ranges" [ ...ranges ] {
enumerate
| flatten
| select ...(row-indices ...$ranges)
}