Neargye / Semver
Licence: mit
Semantic Versioning for modern C++
Stars: ✭ 108
Projects that are alternatives of or similar to Semver
Semver
Semantic versioning helper library for PHP
Stars: ✭ 144 (+33.33%)
Mutual labels: semver, semantic-versioning
next-ver
Tells you the next semantic version for your local package
Stars: ✭ 27 (-75%)
Mutual labels: semver, semantic-versioning
Semantic Release
📦🚀 semantic-release written in go
Stars: ✭ 113 (+4.63%)
Mutual labels: semver, semantic-versioning
gradle-versioner
Gradle Version Plugin. Generates semantic versions with git meta data per branch.
Stars: ✭ 25 (-76.85%)
Mutual labels: semver, semantic-versioning
Python Semver
Python package to work with Semantic Versioning (http://semver.org/)
Stars: ✭ 264 (+144.44%)
Mutual labels: semver, semantic-versioning
Commitizen
Create committing rules for projects 🚀 auto bump versions ⬆️ and auto changelog generation 📂
Stars: ✭ 477 (+341.67%)
Mutual labels: semver, semantic-versioning
Version
Represent and compare versions via semantic versioning (SemVer) in Swift
Stars: ✭ 160 (+48.15%)
Mutual labels: semver, semantic-versioning
git-semver
a small cli tool to version your git repository with semantic versioning
Stars: ✭ 19 (-82.41%)
Mutual labels: semver, semantic-versioning
bump
🌻 CLI tool to draft a GitHub Release for the next semantic version
Stars: ✭ 40 (-62.96%)
Mutual labels: semver, semantic-versioning
React Native Version
🔢 Version your React Native or Expo app in a `npm version` fashion.
Stars: ✭ 408 (+277.78%)
Mutual labels: semver, semantic-versioning
Semver
Semantic Versioning (semver) library written in golang
Stars: ✭ 804 (+644.44%)
Mutual labels: semver, semantic-versioning
Printf
Tiny, fast, non-dependent and fully loaded printf implementation for embedded systems. Extensive test suite passing.
Stars: ✭ 1,157 (+971.3%)
Mutual labels: no-dependencies
Physunits Ct Cpp11
A small C++11, C++14 header-only library for compile-time dimensional analysis and unit/quantity manipulation and conversion
Stars: ✭ 67 (-37.96%)
Mutual labels: no-dependencies
Alagarr
🦍 Alagarr is a request-response helper library that removes the boilerplate from your Node.js (AWS Lambda) serverless functions and helps make your code portable.
Stars: ✭ 58 (-46.3%)
Mutual labels: no-dependencies
Semver
Nx plugin to automate semantic versioning and CHANGELOG generation.
Stars: ✭ 99 (-8.33%)
Mutual labels: semver
Expected Dark
Expected objects for C++11 and later (and later perhaps C++98 )
Stars: ✭ 55 (-49.07%)
Mutual labels: no-dependencies
Rock
Create semantic version tags for your Go packages, search and discover new packages
Stars: ✭ 50 (-53.7%)
Mutual labels: semantic-versioning
Nonstd Lite
Parent of *-lite repositories, a migration path to post-C++11 features for pre-C++11 environments
Stars: ✭ 46 (-57.41%)
Mutual labels: no-dependencies
_____ _ _
/ ____| | | (_)
| (___ ___ _ __ ___ __ _ _ __ | |_ _ ___
\___ \ / _ \ '_ ` _ \ / _` | '_ \| __| |/ __|
____) | __/ | | | | | (_| | | | | |_| | (__
|_____/ \___|_| |_| |_|\__,_|_| |_|\__|_|\___|
__ __ _ _ _____
\ \ / / (_) (_) / ____|_ _
\ \ / /__ _ __ ___ _ ___ _ __ _ _ __ __ _ | | _| |_ _| |_
\ \/ / _ \ '__/ __| |/ _ \| '_ \| | '_ \ / _` | | | |_ _|_ _|
\ / __/ | \__ \ | (_) | | | | | | | | (_| | | |____|_| |_|
\/ \___|_| |___/_|\___/|_| |_|_|_| |_|\__, | \_____|
__/ |
|___/
C++ library compare and manipulate versions are available as extensions to the <major>.<minor>.<patch>-<prerelease_type>.<prerelease_number>
format complying with Semantic Versioning 2.0.0
Features
- C++17
- Header-only
- Dependency-free
- Constexpr comparison: <, <=, ==, !=, > >=
- Constexpr from string
- Constexpr to string
- Constexpr range matching
Examples
-
Create
constexpr version v1 = version{1, 2, 3, prerelease::rc, 4}; constexpr version v2 = v1;
-
Сomparison
constexpr semver::version v1{1, 4, 3}; constexpr semver::version v2{1, 2, 4, semver::prerelease::alpha, 10}; static_assert(v1 != v2); static_assert(v1 > v2); static_assert(v1 >= v2); static_assert(v2 < v1); static_assert(v2 <= v1);
-
To string
semver::version v{1, 2, 3, prerelease::rc, 4}; // To string. std::string s1 = v.to_string(); // may throw. // Non-member to string. std::string s2 = semver::to_string(v); // may throw. std::array<char, 32> str = {}; // constexpr to chars, like <https://en.cppreference.com/w/cpp/utility/to_chars>. auto [p, ec] = v.to_chars(str.data(), str.data() + str.size()); // constexpr and no throw. // Non-member constexpr to chars, like <https://en.cppreference.com/w/cpp/utility/to_chars>. auto [p, ec] = semver::to_chars(str.data(), str.data() + str.size(), v); // constexpr and no throw.
-
From string
std::string_view s = "1.2.3-rc.4"; // From chars. semver::version v1{s}; // constexpr and may throw. // User-defined literals '_version'. semver::version v2 = "1.2.3-rc.4"_version; // constexpr and may throw. // constexpr from_chars, like <https://en.cppreference.com/w/cpp/utility/from_chars>. semver::version v3; auto [p, ec] = v3.to_chars(str.data(), str.data() + str.size()); // constexpr and no throw. // Non-member constexpr from chars, like <https://en.cppreference.com/w/cpp/utility/from_chars>. semver::version v4; auto [p, ec] = semver::to_chars(str.data(), str.data() + str.size(), v4); // constexpr and no throw. // Non-member from string. semver::version v5 = semver::from_string(s); // constexpr and may throw. std::optional<version> v6 = semver::from_string_noexcept(s); // constexpr and no throw. // From string. semver::version v6; v7.from_string(s); // constexpr and may throw. bool success = v8.from_string_noexcept(s); // constexpr and no throw.
-
Range matching
constexpr auto range = semver::range(">=1.0.0 <2.0.0 || >3.2.1"); constexpr auto version = semver::version("1.2.3"); if (range.satisfies(version)) { // Do something. }
-
Range matching with prerelease tag
constexpr auto range = semver::range(">1.2.3-beta.1"); constexpr auto version = semver::version("3.4.5-alpha.0"); // By default, version is allowed to satisfy range if at least one comparator with the same [major, minor, patch] has a prerelease tag. static_assert(!range.satisfies(version)); // Suppress this behavior and treat prerelease versions as normal. static_assert(range.satisfies(version, semver::range::option::include_prerelease));
Integration
You should add required file semver.hpp.
If you are using vcpkg on your project for external dependencies, then you can use the neargye-semver package.
Alternatively, you can use something like CPM which is based on CMake's Fetch_Content
module.
CPMAddPackage(
NAME semver
GITHUB_REPOSITORY Neargye/semver
GIT_TAG x.y.z # Where `x.y.z` is the release version you want to use.
)
Compiler compatibility
- Clang/LLVM >= 5
- MSVC++ >= 14.11 / Visual Studio >= 2017
- Xcode >= 10
- GCC >= 7
MIT License
Licensed under theNote that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].