Nushell Has a Free API That Most Developers Dont Know About

# terminal# shell# rust# devtools
Nushell Has a Free API That Most Developers Dont Know AboutAlex Spinov

Nushell is a modern shell where everything is structured data. Pipelines work with tables, not text —...

Nushell is a modern shell where everything is structured data. Pipelines work with tables, not text — think SQL meets bash.

Structured Data

# ls returns a table, not text
ls | where size > 1mb | sort-by modified | first 5

# JSON is native
open package.json | get dependencies | transpose name version

# HTTP requests return structured data
http get https://api.github.com/repos/nushell/nushell | select stargazers_count forks_count
Enter fullscreen mode Exit fullscreen mode

Data Operations

# Group and aggregate
ls **/*.ts | group-by { path parse | get extension } | transpose ext files | each { |r| {ext: $r.ext, count: ($r.files | length)} }

# Filter JSON
open data.json | where age > 25 | select name email | to csv

# Math
[1 2 3 4 5] | math avg  # 3
ls | get size | math sum  # Total directory size
Enter fullscreen mode Exit fullscreen mode

Custom Commands

def greet [name: string, --loud(-l)] {
  let msg = $"Hello, ($name)!"
  if $loud { $msg | str upcase } else { $msg }
}

greet World --loud  # HELLO, WORLD!
Enter fullscreen mode Exit fullscreen mode

Config (~/.config/nushell/config.nu)

$env.config = {
  show_banner: false
  table: { mode: rounded }
  completions: { algorithm: fuzzy }
}
Enter fullscreen mode Exit fullscreen mode

Key Features

  • Structured data pipelines
  • Native JSON, CSV, YAML, TOML
  • Type system and errors
  • Cross-platform (Rust)
  • Custom commands with types

Need to scrape or monitor web data at scale? Check out my web scraping actors on Apify or email spinov001@gmail.com for custom solutions.