#semver #nushell-plugin #plugin #versioning #nu #bump-version

app nu_plugin_semver

A nushell plugin for dealing with SemVer versions

7 releases (breaking)

new 0.6.0 Jul 24, 2024
0.5.0 Jun 26, 2024
0.4.1 Jun 6, 2024
0.4.0 May 29, 2024
0.1.0 Jan 11, 2024

#330 in Parser implementations

Download history 20/week @ 2024-03-28 10/week @ 2024-04-04 152/week @ 2024-05-09 19/week @ 2024-05-16 172/week @ 2024-05-23 36/week @ 2024-05-30 199/week @ 2024-06-06 6/week @ 2024-06-13 164/week @ 2024-06-20 24/week @ 2024-06-27 6/week @ 2024-07-04

194 downloads per month

MIT and maybe CC-PDDC

34KB
796 lines

Nushell plugin to deal with SemVer versions

This is a plugin for the nu shell to manipulate strings representing versions that conform to the SemVer specification.

Installation

You can compile from source by checking out this repository and running cargo install --path ., or installing the latest version with cargo install nu_plugin_semver.

In both cases you then need to register the plugin by running plugin add /path/to/nu_plugin_semver from within nu. Typically, the plugin can be found in $HOME/.cargo/bin/.

Examples

# Parse a semver string into a semver value
> let v = "1.2.3-alpha.1+build" | into semver

# You can access individual fields of a version:
> $v.minor
2

# You can bump a version to different levels:
> $v | semver bump patch
1.2.3+build

> $v | semver bump major
2.0.0

# Semver values can be turned back into strings using
> $v | to text

# Semver values can be matched against a version requirement:
> let v = "3.2.1" | into semver

>  $v | semver match-req "3"
true

>  $v | semver match-req ">=2"
true

>  $v | semver match-req ">=2,<3"
false

# Semver values can be sorted, according to semver semantics
❯ ["3.2.1", "2.3.4", "3.2.2", "2.3.4-beta.1", "2.3.4-alpha.1", "2.3.4-alpha.2"] | into semver | sort
╭───┬───────────────╮
│ 02.3.4-alpha.1 │
│ 12.3.4-alpha.2 │
│ 22.3.4-beta.1  │
│ 32.3.4         │
│ 43.2.1         │
│ 53.2.2         │
╰───┴───────────────╯

Dependencies

~24–54MB
~1M SLoC