nushell / nushell/nushell

[from ssv -a] (you knew this one was coming)

Open
#18,741 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Here's a sample aligned space-seperated value table:

❄ calliope@chesapeake:  …/essay   main $!?⇡   22:49 
➜ df -ahT -t ramfs -t tmpfs

Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   24G  6.7M   24G   1% /run
tmpfs          tmpfs   47G  392M   47G   1% /dev/shm
ramfs          ramfs     0     0     0    - /run/keys
none           tmpfs  1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
tmpfs          tmpfs   47G  1.2M   47G   1% /run/wrappers
tmpfs          tmpfs  250M     0  250M   0% /var/lib/incus/devices
tmpfs          tmpfs  100K     0  100K   0% /var/lib/incus/shmounts
tmpfs          tmpfs  100K     0  100K   0% /var/lib/incus/guestapi
tmpfs          tmpfs  9.4G   48K  9.4G   1% /run/user/1000

Here's from_ssv:

❄ calliope@chesapeake:  …/essay   main $!?⇡   22:49 
➜ df -ahT -t ramfs -t tmpfs | from ssv
╭───┬────────────┬───────┬──────┬────────────────────────────╮
│ # │ Filesystem │ Type  │ Size │ Used Avail Use% Mounted on │
├───┼────────────┼───────┼──────┼────────────────────────────┤
│ 0 │ tmpfs      │ tmpfs │ 24G  │ 6.7M                       │
│ 1 │ tmpfs      │ tmpfs │ 47G  │ 386M                       │
│ 2 │ ramfs      │ ramfs │ 0    │ 0                          │
│ 3 │ none       │ tmpfs │ 1.0M │ 0                          │
│ 4 │ tmpfs      │ tmpfs │ 47G  │ 1.2M                       │
│ 5 │ tmpfs      │ tmpfs │ 250M │ 0                          │
│ 6 │ tmpfs      │ tmpfs │ 100K │ 0                          │
│ 7 │ tmpfs      │ tmpfs │ 100K │ 0                          │
│ 8 │ tmpfs      │ tmpfs │ 9.4G │ 48K                        │
╰───┴────────────┴───────┴──────┴────────────────────────────╯

Here's from ssv -a (aligned columns):

❄ calliope@chesapeake:  …/essay   main $!?⇡   22:49 
➜ df -ahT -t ramfs -t tmpfs | from ssv -a
╭───┬────────────┬───────┬──────┬──────────────────────────────────────────────────╮
│ # │ Filesystem │ Type  │ Size │            Used Avail Use% Mounted on            │
├───┼────────────┼───────┼──────┼──────────────────────────────────────────────────┤
│ 0 │ tmpfs      │ tmpfs │ 24G  │ 6.7M   24G   1% /run                             │
│ 1 │ tmpfs      │ tmpfs │ 47G  │ 381M   47G   1% /dev/shm                         │
│ 2 │ ramfs      │ ramfs │ 0    │ 0     0    - /run/keys                           │
│ 3 │ none       │ tmpfs │ 1.0M │ 0  1.0M   0%                                     │
│   │            │       │      │ /run/credentials/systemd-journald.service        │
│ 4 │ tmpfs      │ tmpfs │ 47G  │ 1.2M   47G   1% /run/wrappers                    │
│ 5 │ tmpfs      │ tmpfs │ 250M │ 0  250M   0% /var/lib/incus/devices              │
│ 6 │ tmpfs      │ tmpfs │ 100K │ 0  100K   0% /var/lib/incus/shmounts             │
│ 7 │ tmpfs      │ tmpfs │ 100K │ 0  100K   0% /var/lib/incus/guestapi             │
│ 8 │ tmpfs      │ tmpfs │ 9.4G │ 48K  9.4G   1% /run/user/1000                    │
╰───┴────────────┴───────┴──────┴──────────────────────────────────────────────────╯

Close! Maybe we need a smaller minimum column. 1 space is the only choice that makes sense.

❄ calliope@chesapeake:  …/essay   main $!?⇡   22:49 
➜ df -ahT -t ramfs -t tmpfs | from ssv -a -m 1
╭───┬────────────┬───────┬──────┬──────┬───────┬──────┬──────────┬─────────────────╮
│ # │ Filesystem │ Type  │ Size │ Used │ Avail │ Use% │ Mounted  │       on        │
├───┼────────────┼───────┼──────┼──────┼───────┼──────┼──────────┼─────────────────┤
│ 0 │ tmpfs      │ tmpfs │ 24G  │ 6.7M │ 24G   │ 1%   │ /run     │                 │
│ 1 │ tmpfs      │ tmpfs │ 47G  │ 400M │ 47G   │ 1%   │ /dev/shm │                 │
│ 2 │ ramfs      │ ramfs │ 0    │ 0    │ 0     │ -    │ /run/key │ s               │
│ 3 │ none       │ tmpfs │ 1.0M │ 0    │ 1.0M  │ 0%   │ /run/cre │ dentials/system │
│   │            │       │      │      │       │      │          │ d-journald.serv │
│   │            │       │      │      │       │      │          │ ice             │
│ 4 │ tmpfs      │ tmpfs │ 47G  │ 1.2M │ 47G   │ 1%   │ /run/wra │ ppers           │
│ 5 │ tmpfs      │ tmpfs │ 250M │ 0    │ 250M  │ 0%   │ /var/lib │ /incus/devices  │
│ 6 │ tmpfs      │ tmpfs │ 100K │ 0    │ 100K  │ 0%   │ /var/lib │ /incus/shmounts │
│ 7 │ tmpfs      │ tmpfs │ 100K │ 0    │ 100K  │ 0%   │ /var/lib │ /incus/guestapi │
│ 8 │ tmpfs      │ tmpfs │ 9.4G │ 48K  │ 9.4G  │ 1%   │ /run/use │ r/1000          │
╰───┴────────────┴───────┴──────┴──────┴───────┴──────┴──────────┴─────────────────╯

um. those last two columns were broken up? it's one column. the last one column, "Mounted on", became two columns, simply because the column name had a space. None of the values, file paths, had spaces. Only the header row is used to decide where the column breaks?

Again, to keep you from scrolling, original:

❄ calliope@chesapeake:  …/essay   main $!?⇡   22:49 
➜ df -ahT -t ramfs -t tmpfs

Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   24G  6.7M   24G   1% /run
tmpfs          tmpfs   47G  392M   47G   1% /dev/shm
ramfs          ramfs     0     0     0    - /run/keys
none           tmpfs  1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
tmpfs          tmpfs   47G  1.2M   47G   1% /run/wrappers
tmpfs          tmpfs  250M     0  250M   0% /var/lib/incus/devices
tmpfs          tmpfs  100K     0  100K   0% /var/lib/incus/shmounts
tmpfs          tmpfs  100K     0  100K   0% /var/lib/incus/guestapi
tmpfs          tmpfs  9.4G   48K  9.4G   1% /run/user/1000

Because none (not-all) of the file paths have a space separator at column... 63?
63 should be considered a piece of a larger column. the -a flag, aligned,
implies that all rows have the same --minimum number of spaces in the same column positions.

I'm sure this is going to play hell with streamed ssvs,
and that's a good excuse for the current mechanism.
Maybe we can add another -a -similar option
that seeks ahead through each row to find the columns that are shared in common?

--aligned-rows (-A) # reads all rows in the input to find column boundaries. Honors --minimum-spaces. Non-streaming.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the from ssv command and its existing -a/--aligned and --minimum-spaces handling. Review how streamed rows currently determine column boundaries, then define the proposed --aligned-rows (-A) behavior from the examples: read all rows, find shared boundaries, and honor the minimum spacing. Done means headers containing spaces no longer split a single value column when -A is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.