From 24574aef2299925c10eeb9d20a942f36d1d806d4 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 22 Apr 2021 08:27:04 +0300 Subject: feat: use project's name in git tag template --- src/debian.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/debian.rs') diff --git a/src/debian.rs b/src/debian.rs index 3f9e01b..15b87ed 100644 --- a/src/debian.rs +++ b/src/debian.rs @@ -19,6 +19,24 @@ impl Debian { Err(BumperError::UnknownProjectKind(dirname.to_path_buf())) } + pub fn name(&self) -> Result { + let output = Command::new("dpkg-parsechangelog") + .arg("-SSource") + .current_dir(&self.dirname) + .output() + .map_err(|err| BumperError::ParseChangelogInvoke(self.dirname.to_path_buf(), err))?; + if output.status.success() { + let name = String::from_utf8_lossy(&output.stdout).into_owned(); + Ok(name.trim_end().to_string()) + } else { + let stderr = String::from_utf8_lossy(&output.stderr).into_owned(); + Err(BumperError::ParseChangelog( + self.dirname.to_path_buf(), + stderr, + )) + } + } + pub fn set_version(&mut self, version: &str) -> Result { let version = format!("{}-1", version); self.dch(&["-v", &version, ""])?; -- cgit v1.2.1