Home Explore Blog CI



nushell

1st chunk of `blog/2021-01-05-nushell_0_25.md`
c6f41dfc49ee1160d38d7c615102510944676983703cf1b50000000100000cb5
---
title: Nushell 0.25
author: The Nu Authors
author_site: https://twitter.com/nu_shell
author_image: https://www.nushell.sh/blog/images/nu_logo.png
excerpt: Today, we're releasing 0.25 of Nu. It's one of the largest releases we've ever done.
---

# Nushell 0.25

Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines.

Today, we're releasing 0.25 of Nu. It's one of the largest releases we've ever done. With it Nushell grows from being a shell to being a full scripting language as well.

<!-- more -->

# Where to get it

Nu 0.25 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.25.1) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`.

If you want all the goodies, you can install `cargo install nu --features=extra`.

As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_<plugin name>`.

# What's New

Lots of new features in this release. If you'd like to watch a demonstration, we can also watch a [video showing off the new features](https://www.youtube.com/watch?v=PO6EW7_a1tE).

## Custom commands

A long-requested feature for Nushell is to have scripting capability. A key piece of this story is the ability to make your own commands in addition to those built into Nu.

With 0.25, you can now make your own custom commands:

```
def add [x, y] {
    = $x + $y
}

add 1 5
```

The definitions are created in the scope where you define them, and are visible before any of the script body runs. This allows you to have written the above like so:

```
add 1 5

def add [x, y] {
    = $x + $y
}
```

There are a few other important features of custom commands. The first is that you can optionally add a type annotation to each parameter you take in. These type annotations tell the parser how to parse arguments given to the function and tell the type checker what is allowed to be passed in.

```
def add [x:int, y] {
    = $x + $y
}

add "bob" 4
```

Now if you run the example, you'll see a type error like this:

```
error: Type Error
  ┌─ shell:5:5
  │
5 │ add "bob" 4
  │     ^^^^^ Expected int, found "bob"
```

Here's a list of the types that are allowed:

- int - an integer
- string - a string
- path - a filepath
- table - a table
- unit - a number with a unit (like `10kb`)
- number - an integer or decimal number
- pattern - a glob pattern (like `foo*`)
- range - a numeric range (like `1..10`)
- block - a code block (like `{ ls }`)
- any - any of the above types (this is assumed if you leave off the type)

_Note: Nushell is whitespace-significant, so the variable + ':' + type need to be united as one, without spaces._

You can also create flags for your commands:

```
def create-item(name, --age:int) { ... }

create-item "driver" --age 20
```

## Variables

You can now also define variables using `let`.

```
let name = "Nushell"
echo $name
```

These variables are created in the scope they're defined in.

Title: Nushell 0.25 Release: Custom Commands and Variables
Summary
Nushell 0.25 is a major release that introduces scripting capabilities, including custom commands and variables. Custom commands can be defined with type annotations for parameters and flags. Variables can be defined using the `let` keyword within specific scopes.