Nuten
Nuten のロゴ

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 }
    }
}

インストール

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

正しさを保つ仕組み

ベンチマーク

速度 · 1,497 ファイルを整形する時間
nuten2.8x 高速58 ms
nufmt162 ms
メモリ · 1,497 ファイルを整形するときの最大使用量
nuten2.1x 省メモリ24.5 MiB
nufmt52.3 MiB
バイナリサイズ · 実行ファイルの大きさ
nuten4.0x 小型3.2 MiB
nufmt12.9 MiB
正しさ · 1,752 ファイルのうち AST が変わったファイル
nutenAST を変えない0 ファイル
nufmt254 ファイル

詳しい結果と計測の方法は 性能 を参照してください。

エディタとツール

CLI から普段使っているツールまで、同じフォーマッタで整形できます。