Stòiridh’s Version
Stòiridh Version is a tiny library that implements the Semantic Versioning Specification 2.0.0.
Installation
In your Gleam project, you can add it by typing the following command in your terminal.
gleam add stoiridh_version
Usage
import gleam/io
import gleam/result
import stoiridh/version
pub fn main() {
use v1 <- result.map(
version.new(5, 12, 4)
|> version.with_prerelease("alpha.20")
|> version.with_build_metadata("49ae79"),
)
use v2 <- result.map(
version.parse("8.0.0")
|> version.with_build_metadata("dev"),
)
v1
|> version.to_string
|> io.println
v2
|> version.to_string
|> io.println
v1
|> version.compare(v2)
|> io.debug
}
Output:
5.12.4-alpha.20+49ae79
8.0.0+dev
Lt
Further documentation can be found at https://hexdocs.pm/stoiridh_version.
Development
gleam test # Run the tests
gleam shell # Run an Erlang shell
Sponsorship
If you’d like to support my work, you can consider . These donations will help me to continue my work on what I believe and share more projects.
Author
This library and the logo is a creation of William McKIE.
Licence
Copyright © 2024 William McKIE.
This project is licenced under the Apache License 2.0.