Include git HEAD rev in version output

Closes #241
This commit is contained in:
dbr
2021-05-21 16:31:25 +10:00
parent 2345a57940
commit 00089639fe
3 changed files with 42 additions and 1 deletions

View File

@@ -3,8 +3,13 @@ use termcolor::{ColorSpec, WriteColor};
pub(crate) fn execute<W: WriteColor>(w: &mut W) -> anyhow::Result<()> {
write!(w, "TaskChampion ")?;
w.set_color(ColorSpec::new().set_bold(true))?;
writeln!(w, "{}", env!("CARGO_PKG_VERSION"))?;
write!(w, "{}", env!("CARGO_PKG_VERSION"))?;
w.reset()?;
if let Some(h) = option_env!("TC_GIT_REV") {
write!(w, " (git rev: {})", h)?;
}
writeln!(w)?;
Ok(())
}