M6A6H2RURXUQHHW5WY2ZD753U7A5WBOEC2JJWVMPYU3MEQ7HNENQC
/// Bump to a major release version, regardless of the conventional commits.
/// Instead of printing out the bumped version, prints out one of: major, minor or patch
#[structopt(short, long, conflicts_with_all(&["major", "minor", "patch"]))]
pub label: bool,
/// Bump to a major release version, regardless of the conventional commits
use std::fmt;
enum Label {
/// Bump minor version (0.1.0 -> 1.0.0)
Major,
/// Bump minor version (0.1.0 -> 0.2.0)
Minor,
/// Bump the patch field (0.1.0 -> 0.1.1)
Patch,
/// Remove the pre-release extension; if any (0.1.0-dev.1 -> 0.1.0, 0.1.0 -> 0.1.0)
Release
}
impl fmt::Display for Label {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Self::Major => write!(f, "major"),
Self::Minor => write!(f, "minor"),
Self::Patch => write!(f, "patch"),
Self::Release => write!(f, "release"),
}
}
}
match (major, minor, patch) {
(true, _, _) => last_version.increment_major(),
(false, true, _) => last_version.increment_minor(),
(false, false, true) => last_version.increment_patch(),
let label = match (major, minor, patch) {
(true, _, _) => {
last_version.increment_major();
Label::Major
},
(false, true, _) => {
last_version.increment_minor();
Label::Minor
},
(false, false, true) => {
last_version.increment_patch();
Label::Patch
}