From 3f68ce4a8e9b295a4b9fc288174f166e229da8b0 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 22 Apr 2021 08:09:21 +0300 Subject: feat: allow setting git tag name template --- src/bin/bumper.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/bin') diff --git a/src/bin/bumper.rs b/src/bin/bumper.rs index 59443e5..fb5194a 100644 --- a/src/bin/bumper.rs +++ b/src/bin/bumper.rs @@ -1,6 +1,7 @@ use bumper::errors::BumperError; use bumper::git; use bumper::project::ProjectKind; +use bumper::tag::Tag; use log::{debug, error}; use std::path::{Path, PathBuf}; use std::process::exit; @@ -25,9 +26,13 @@ fn bumper() -> Result<(), BumperError> { println!("{} project set to {}", kind.desc(), version); } - let msg = format!("Set version to {}", opt.version); + let msg = format!("Release version {}", opt.version); git::commit(".", &msg)?; - git::tag(".", &opt.version)?; + + let tag = Tag::new(&opt.tag)?; + let tag = tag.apply("", &opt.version); + println!("release tag: {}", tag); + git::tag(".", &tag, &msg)?; debug!("Bumper ends OK"); Ok(()) } @@ -41,6 +46,9 @@ fn abspath>(path: P) -> Result { #[derive(Debug, StructOpt)] struct Opt { + #[structopt(long, default_value = "v%v")] + tag: String, + #[structopt(help = "version number of new release")] version: String, } -- cgit v1.2.1