#semver #version #semantic #command #command-line-tool #utility #seq

app semver-util

command line utility for working with semantic versions

5 releases

0.2.1 Sep 29, 2022
0.2.0 Sep 29, 2022
0.1.2 Sep 28, 2022
0.1.1 Sep 28, 2022
0.1.0 Sep 28, 2022

#2427 in Command line utilities

Download history 26/week @ 2023-12-15 1/week @ 2023-12-22 42/week @ 2024-02-09 100/week @ 2024-02-16 35/week @ 2024-02-23 3/week @ 2024-03-01 171/week @ 2024-03-08 16/week @ 2024-03-15 32/week @ 2024-03-29

220 downloads per month

MIT license

9KB
99 lines

semver-util

Crate Docs Minimum rustc version Open issues

Getting Started

$ cargo install semver-util
$ semver --help
Usage: semver <COMMAND>

Commands:
  cmp      Compare ordinality of two versions
  seq      Generate a sequence of versions
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help information

Comparing Versions

Use the cmp command to check ordinality of two semantic versions. The command will output true or false to stdout. The process exit code is also set to 1 for commands that output false.

$ semver cmp 1.2.3 gt 1.2.0
true

$ semver cmp 1.2.3 lt 1.2.0
false

$ semver cmp 1.2.3 gte 1.2.3
true

$ semver cmp 1.2.3 lte 1.2.2
false

$ semver cmp 1.2.3 eq 1.2.3
true

Comparing versions in another shell script

#!/usr/bin/env bash

set -e

old_version () {
  echo "old version detected"
}

new_version () {
  echo "new version detected"
}

semver cmp $1 gt $2 > /dev/null \
  && new_version \
  || old_version

Generate Version Sequences

Minor Version Sequence

$ semver seq --minor --minor-max 8 1.0.0 2.5.0
1.0.0
1.1.0
1.2.0
1.3.0
1.4.0
1.5.0
1.6.0
1.7.0
1.8.0
2.0.0
2.1.0
2.2.0
2.3.0
2.4.0
2.5.0

Dependencies

~2.5MB
~52K SLoC