Nuten
Nuten logo

Nuten

A formatter for Nushell

Robust, fast, and lightweight.

Compare

# Pick a branch in a TUI and switch to it
def "git pick" [--remote(-r)] {
let flags = if $remote {[--remotes]} else {[]}
let picked = ^git branch --format "%(refname:short)%09%(upstream:short)" ...$flags|lines|parse "{name}\t{upstream}"
  |tui label --title "branches"|tui search --placeholder "filter" --bind /
    | tui split --sizes [40% 1fr] [(tui table --columns [name upstream])
  (tui preview {|row| ^git log --oneline -n 20 $row.name})]
    |tui label --status "enter: switch  q: quit"|tui run

match $picked {
{action: quit} => {print "Nothing picked"}
{selected: {name: $name}} if ($name|str starts-with "origin/") => {
^git switch --track $name}
  {selected: {name: $name}} => {^git switch $name}
}
}
# Pick a branch in a TUI and switch to it
def "git pick" [--remote(-r)] {
    let flags = if $remote { [--remotes] } else { [] }
    let picked = ^git branch --format "%(refname:short)%09%(upstream:short)" ...$flags
        | lines
        | parse "{name}\t{upstream}"
        | tui label --title "branches"
        | tui search --placeholder "filter" --bind /
        | tui split --sizes [40%, 1fr] [
              (tui table --columns [name, upstream])
              (tui preview {|row| ^git log --oneline -n 20 $row.name })
          ]
        | tui label --status "enter: switch  q: quit"
        | tui run

    match $picked {
        { action: quit } => { print "Nothing picked" }
        { selected: { name: $name } } if ($name | str starts-with "origin/") => {
            ^git switch --track $name
        }
        { selected: { name: $name } } => { ^git switch $name }
    }
}

Install

cargo install --git https://github.com/mst-mkt/nuten nuten
nix profile install github:mst-mkt/nuten

How Nuten stays correct

Benchmark

Speed · time to format 1,497 files
nuten2.8x faster58 ms
nufmt162 ms
Memory · peak memory while formatting 1,497 files
nuten2.1x less24.5 MiB
nufmt52.3 MiB
Binary size · size of the executable
nuten4.0x smaller3.2 MiB
nufmt12.9 MiB
Correctness · files out of 1,752 whose AST changed
nutenno AST changes0 files
nufmt254 files

See Performance for more results and how they are measured.

Editors and tools

The same formatter, from the CLI to the tools you already use.