Tools#

Nushell’s toolchain is small and uniform: one interpreter (nu), one plugin protocol, a built-in profiler, and a debugger. Most of what bash / zsh operators reach for third- party tools to do (linting, formatting, structured logging) is either built in or covered by the standard library.

Interpreter#

  • nu, the Z shell’s structured-data cousin. Cross-platform.

Check the version.

version
version | get version

Useful invocation flags.

Flag

Effect

-c 'expr'

Run an expression and exit

script.nu

Run a script

--commands

Same as -c

--config path

Use a specific config.nu

--env-config path

Use a specific env.nu

--no-config-file / -n

Skip both config files (clean shell)

--no-std-lib

Skip loading the standard library

--testbin

Use a built-in test binary for plugin protocol checks

$ nu -n -c 'ls | first 3'
$ nu --no-config-file ./script.nu

Plugins#

Plugins are external binaries that speak the Nu plugin protocol and add new commands. Registration persists across sessions.

plugin list                                    # what is registered
plugin add ~/.cargo/bin/nu_plugin_polars
plugin use polars                              # load in this session
plugin rm polars                               # unregister

Install via the project’s build system, usually cargo install nu_plugin_<name>.

Linting#

No mature standalone linter at the moment. The closest reach is nu --ide-check or relying on the in-shell errors that surface at parse time.

nu --ide-check script.nu                       # parse-time errors / warnings

Editor plugins (VS Code Nushell extension, vim-nu) surface the same diagnostics inline.

Formatting#

No standalone formatter. The Nu parser itself is strict enough that most syntactic style is enforced at parse time. Editor plugins handle indent.

Testing#

  • nutest, TAP-style test framework written for Nu.

  • std assert, in-shell assertion helpers for ad-hoc tests.

use std

def "test addition" [] {
    std assert equal (2 + 3) 5
}

test addition

Debugging#

Nu’s debug primitives.

debug $value                                   # print a structured view
describe $value                                # type of the value
metadata $value                                # span info (for errors)
inspect $value                                 # print + return for chaining

A pipeline-friendly inspector.

ls | inspect | where size > 1MB | inspect

inspect prints to stderr and forwards the value, so the operator can drop it anywhere in a pipeline without breaking it.

Profiling#

timeit measures how long an expression takes.

timeit { open big.json | where status == "open" }
timeit { ls **/* | length }

For startup-time profiling, nu --no-config-file baselines against a shell with no init; the diff against a full shell reveals what config is costing.

Editing#

  • VS Code Nushell, LSP, syntax highlighting, snippets.

  • vim-nu, Neovim plugin.

  • The interactive Nu shell itself is the most common scratchpad; rapid iteration on real data is one of the reasons people pick Nu.

CI Integration#

Nu on the runner. The standard pattern.

# GitHub Actions
- uses: hustcer/setup-nu@v3
  with:
    version: '*'
- shell: nu {0}
  run: |
    open data.json | length

Pin the version on shared CI scripts; Nu is still pre-1.0 in spirit, and minor releases can change command signatures.

References#