tg 0.4.0

Telegram CLI client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::process::Command;

fn main() {
	let git_hash = Command::new("git")
		.args(["rev-parse", "--short", "HEAD"])
		.output()
		.ok()
		.and_then(|o| if o.status.success() { Some(o.stdout) } else { None })
		.and_then(|stdout| String::from_utf8(stdout).ok())
		.map(|s| s.trim().to_string())
		.unwrap_or_else(|| "unknown".to_string());

	println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}