Search

Dark theme | Light theme

March 2, 2025

Nushell Niceties: Getting The Current Version Of Nushell

The version command can be used to get the current version of Nushell. The result is a record structure with different keys with information about the Nushell version. For example the property version contains the current version of Nushell, the properties major, minor and patch contain the major, minor and patch version of Nushell.

The version command accepts the argument check to check if a newer version of Nushell is available. The returned record structure contains the property current with a value true or false depending on whether a newer version is available. The version check command also return the latest version as value of the property latest.

In the following example you see output of the version command:

> version
╭────────────────────┬────────────────────────────────────────────────╮
│ version            │ 0.102.0                                        │
│ major              │ 0                                              │
│ minor              │ 102                                            │
│ patch              │ 0                                              │
│ branch             │                                                │
│ commit_hash        │                                                │
│ build_os           │ macos-x86_64                                   │
│ build_target       │ x86_64-apple-darwin                            │
│ rust_version       │ rustc 1.84.1 (e71f9a9a9 2025-01-27) (Homebrew) │
│ cargo_version      │ cargo 1.84.1                                   │
│ build_time         │ 2025-02-04 15:49:35 +00:00                     │
│ build_rust_channel │ release                                        │
│ allocator          │ mimalloc                                       │
│ features           │ default, sqlite, trash                         │
│ installed_plugins  │                                                │
╰────────────────────┴────────────────────────────────────────────────╯

You can also use all record navigation options to get specific information from the version command output:

> version | get version
0.102.0
> version | get features
default, sqlist, trash

The following example output of the version check command shows the latest version of Nushell is used:

> version check
╭─────────┬─────────╮
│ channel │ release │
│ current │ true    │
│ latest  │ 0.102.0 │
╰─────────┴─────────╯

The following example uses the if command to check if the current version of Nushell is the latest version:

# Check if the current property of version check is true.
> if (version check).current {
    let v = version
    print $'You are using the latest version of Nushell -> ($v.version)'
}
You are using the latest version of Nushell -> 0.102.0

Written with Nushell 0.102.0.