Questions tagged [nushell]

A flexible cross-platform shell with structured data, a programming language, clear error messages, IDE support, and its own (input) line editor "reedline".

Adapted from the Nushell Book:

The goal of the Nushell project is to take the Unix philosophy of shells, where pipes connect simple commands together, and bring it to the modern style of development.

Nu takes cues from a lot of familiar territory: traditional shells like bash, object based shells like PowerShell, gradually typed languages like TypeScript, functional programming, systems programming, and more. But rather than trying to be a jack of all trades, Nu focuses its energy on doing a few things well:

  • Being a flexible cross-platform shell with a modern feel
  • Solving problems as a modern programming language that works with the structure of your data
  • Giving clear error messages and clean IDE support
11 questions
11
votes
1 answer

How to get a list of keys from a record?

I have a record {a:1, b:2}. I would like to know how to get list of keys from it, which would return [a b] in this case.
6
votes
3 answers

nushell: list all files recursively

How can I list files recursively with the nu shell? More specifically: All files, folders and everything else in a specified folder and every inner folder, recursively. I tried ls **, but that does not work. I googled, found ls **/**.rs on Coming…
5
votes
1 answer

nushell: Add computed column to table

How can I add a column in a table in nushell, which computes its values from other columns? For example, I would like to split the column "name" into "path without name" and "local name" for ls -a -f **/*, by adding these two columns and dropping…
4
votes
4 answers

How do I change the default location for nushell configration files

I noticed the default location for nushell's configuration files on Mac OS is ~/Library/Application Support/nushell/, is it possible to change it to another location?
Jian
  • 191
4
votes
2 answers

What's the opposite of `/` in Command Prompt (nushell)?

Whenever I accidentally press / +Return. I end up at the root of the current drive, or C:\. Is there an opposite operation? A shortcut to last location? Anything? I'm using nushell, on Windows 10.
Mossa
  • 151
3
votes
1 answer

Finding the line count of source files as a table in nushell

I'm very early in trying to learn nushell, sorry! … I'd like to build a table with all the recursively found ".swift" source files in a folder, and then append an additional column that contains their (computed) line count. I've used this answer…
Benjohn
  • 133
  • 3
3
votes
1 answer

Skipping lines in a large file, then pipe to external command in Nushell

I'm trying to write a very simple Nushell script. I want to skip the first 46 lines and pipe the rest to an external command. In Bash: zcat filename.sql.gz | tail -n +46 | mysql dbname Since Nushell's open doesn't seem to support compressed…
Hut8
  • 235
2
votes
1 answer

nushell: open excel files and search them for a text

I would like to use Nu to open several Excel files, search them for text and print the line of each match along with its location. For example: hugh file.xsls, sheet 123, line 98765: ... todo ... To open a single file, I tried: open "huge…
1
vote
1 answer

Nushell: List directories first, including symlinks to directories

Using Nushell I want ls to list directories before files. Additionally, I want symbolic links to be sorted correctly: If it is a link to a directory, it should be included in the list of directories. And if it is a link to a file, it should be in…
1
vote
0 answers

Nushell progress status length and index

I am running some image transcoding tasks using taskfile and Nushell -- using Nconvert to transcode. transcode-jpegxl: #!nu let read_img_files = { ls -f **/* | where type == file | get name} do $read_img_files | enumerate | par-each {|it|…
Shah-G
  • 161
1
vote
1 answer

nushell: pass list of filtered files to external program

I want Nu to find some files for me, filter them and pass them to an external program. For example: "Revert all files whose name contains 'GENERATED' with Git." I tried several variants, but none of them work: # Doesn't pass the files: ls --all…