Crates.io | semver-extra |
lib.rs | semver-extra |
version | 0.2.5 |
source | src |
created_at | 2024-06-27 03:03:06.495519 |
updated_at | 2024-07-03 03:11:12.479008 |
description | Helper functions for the semver crate, complete with a CLI tool. |
homepage | https://github.com/nicholaschiasson/semver-extra |
repository | https://github.com/nicholaschiasson/semver-extra |
max_upload_size | |
id | 1285044 |
size | 32,184 |
Helper functions for the semver crate, complete with a CLI tool.
This project also publishes a binary application for use on the command line.
For now, crates.io is the only place this is being distributed.
cargo install semver-extra
A Rust implementation of the https://semver.org/ specification
Usage: semver [VERSION] [COMMAND]
Commands:
increment Increment a component of the version, resetting those of lower significance [aliases: i]
get Output a specific component of the version [aliases: g]
help Print this message or the help of the given subcommand(s)
Arguments:
[VERSION] The input semantic version. If omitted, input is taken from stdin
Options:
-h, --help Print help
-V, --version Print version
semver hello.world
error: invalid value 'hello.world' for '[VERSION]': unexpected character 'h' while parsing major version number
For more information, try '--help'.
semver 1.2.3 increment minor
1.3.0
semver 1.0.0-rc.12 get prerelease
rc.12
echo 1.0.2 | semver i
1.0.3
This project also publishes a docker image, exposing the CLI tool.
You can pull the image from GitHub's container registry:
docker pull ghcr.io/nicholaschiasson/semver-extra:latest
Or for more convenience, you can reference the image in a docker compose file:
---
services:
semver:
image: ghcr.io/nicholaschiasson/semver-extra:latest
For extra convenience, you can create an alias to the docker compose command:
echo 'alias semver="docker compose --file path/to/docker-compose.yml run --rm semver"' >> "${HOME}/.bashrc"
source "${HOME}"/.bashrc
After that, you should be able to simply run semver
to invoke the container.
The docker image entrypoint is the semver CLI binary itself, meaning the usage is the exact same as indicated above.
docker run ghcr.io/nicholaschiasson/semver-extra 1.2.3 i major
2.0.0
docker compose run semver 12.34.56 i
12.34.57
Create the development shell environment. Necessary to run all other commands.
nix develop
Build with cargo.
just build
Check the code with cargo's built-in fast static analysis.
just check
Remove build files.
just clean
Format the code.
just format
Check the code with clippy for better static analysis.
just lint
Run the application.
just run
Run tests with cargo's built-in test runner.
just test
Watch for code changes and rebuild.
just watch
All just
commands can accept additional command line arguments after a --
.
For example: run the application with a flag to report the version.
just run -- --version
To get linking to rust binaries in your IDE, you should open the development shell from your terminal and then open your IDE from that shell session. This will carry over the development shell's environment into your IDE.
For example if you work with VSCode.
cd path/to/this/project
nix develop
code .
By doing this, you can install the rust-analyzer VSCode extension and it will work properly since it will be able to point to the correct rust binaries and libraries. You will also have access in VSCode to any packages installed by the nix flake.
#![no-std]