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_versionUsage
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
LtFurther documentation can be found at https://hexdocs.pm/stoiridh_version.
Development
gleam test # Run the tests
gleam shell # Run an Erlang shellSponsorship
If you’d like to support my work, you can consider <script src=”https://liberapay.com/viprip/widgets/button.js”></script><noscript><a href=”https://liberapay.com/viprip/donate”><img alt=”Donate using Liberapay” src=”https://liberapay.com/assets/widgets/donate.svg”></a></noscript>. 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.