From c5c02764bc715dbf6cc758f7b628b29036ad8e80 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 23 May 2015 01:08:40 -0400 Subject: [PATCH 1/2] feat(version headers): distinguishes between minor and patch version headers Patch versions use "###" headers and everything else uses "##" Closes #5 --- src/clogconfig.rs | 5 ++++- src/log_writer.rs | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/clogconfig.rs b/src/clogconfig.rs index 41af2ea..2d445f2 100644 --- a/src/clogconfig.rs +++ b/src/clogconfig.rs @@ -17,6 +17,7 @@ pub struct ClogConfig { pub format: String, pub repo: String, pub version: String, + pub patch_ver: bool, pub subtitle: String, pub from: String, pub to: String, @@ -29,6 +30,7 @@ pub type ConfigResult = Result>; impl ClogConfig { pub fn from_matches(matches: &ArgMatches) -> ConfigResult { // compute version early, so we can exit on error + let mut patch_ver = false; let version = { // less typing later... let (major, minor, patch) = (matches.is_present("major"), matches.is_present("minor"), matches.is_present("patch")); @@ -50,7 +52,7 @@ impl ClogConfig { match (major, minor, patch) { (true,_,_) => { v.major += 1; v.minor = 0; v.patch = 0; }, (_,true,_) => { v.minor += 1; v.patch = 0; }, - (_,_,true) => { v.patch += 1; }, + (_,_,true) => { v.patch += 1; patch_ver = true; }, _ => unreachable!() } format!("{}{}", if had_v{"v"}else{""}, v) @@ -173,6 +175,7 @@ impl ClogConfig { format: "%H%n%s%n%b%n==END==".to_owned(), repo: repo, version: version, + patch_ver: patch_ver, subtitle: subtitle, from: from, to: matches.value_of("to").unwrap_or("HEAD").to_owned(), diff --git a/src/log_writer.rs b/src/log_writer.rs index c6de0af..be9da76 100644 --- a/src/log_writer.rs +++ b/src/log_writer.rs @@ -34,7 +34,11 @@ impl<'a, 'cc> LogWriter<'a, 'cc> { _ => format!(" {}", self.options.subtitle) }; - let version_text = format!("## {}{}", self.options.version, subtitle); + let version_text = if self.options.patch_ver { + format!("### {}{}", self.options.version, subtitle) + } else { + format!("## {}{}", self.options.version, subtitle) + }; let date = time::now_utc(); From a339e6d7ac0ceefd89bb4ca425c0267b417e9d6b Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 23 May 2015 01:10:55 -0400 Subject: [PATCH 2/2] chore(deps): dep update --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bdc324..86068cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ name = "clog" version = "0.6.0" dependencies = [ - "clap 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "regex_macros 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -17,7 +17,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "clap" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",