nushell / nushell/nushell

external commands get formatted tables

Open
#5,617 23 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:external-commands category:inconsistent-behavior
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Describe the bug

consider the pipeline,

ps | each {$"/local/ps/($in.name)|u64|($in.pid)"} | ^cat

One would expect cat to receive lines in the form

/local/ps/{name-of-process}|u64|{pid-of-process}

Instead, nushell formats the table as if it was going to show it to a human, and then sends it on to cat. E.G.

/home/eric/proj/demoscene/views〉ps | each {$"/local/ps/($in.name)|u64|($in.pid)"} | ^head
╭─────┬──────────────────────────────────────────────────────────────────────╮
│   0 │ /local/ps//usr/lib/systemd/systemd|u64|1                             │
│   1 │ /local/ps/kthreadd|u64|2                                             │
│   2 │ /local/ps/rcu_gp|u64|3                                               │
│   3 │ /local/ps/rcu_par_gp|u64|4                                           │
│   4 │ /local/ps/netns|u64|5                                                │
│   5 │ /local/ps/kworker/0:0H-events_highpri|u64|7                          │
│   6 │ /local/ps/mm_percpu_wq|u64|9                                         │
│   7 │ /local/ps/rcu_tasks_kthread|u64|10                                   │
│   8 │ /local/ps/rcu_tasks_rude_kthread|u64|11                              │

This is pretty much entirely useless for interacting with any external command I can think of.

How to reproduce
  1. pipe anything non trivial to an external command
Expected behavior

For a simple list of strings I expect each string to be sent to the external command as 1 line. To be honest, given that primitive, and the already ample string manipulation functions in nushell, you should be able to do most anything.

Screenshots

No response

Configuration

No response

Additional context

No response

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

Reproduce the pipeline shown in the issue, especially piping a list of strings to an external command such as ^head or ^cat. Trace the external-command boundary and determine where structured values are formatted; done means simple string lists reach the command as one unformatted line per item.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.