From f2b1bfdf37aea62e79b1791127eaf1507edfecd9 Mon Sep 17 00:00:00 2001 From: 绅士喵 Date: Fri, 7 Jun 2019 02:46:32 +0800 Subject: Fix build without git --- alacritty/src/cli.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'alacritty/src') diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index 3ecea644..9e7493bc 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -61,12 +61,16 @@ impl Default for Options { impl Options { /// Build `Options` from command line arguments. pub fn new() -> Self { - let mut options = Options::default(); + let mut version = crate_version!().to_owned(); + let commit_hash = env!("GIT_HASH"); + if !commit_hash.is_empty() { + version = format!("{} ({})", version, commit_hash); + } - let version_string = format!("{} ({})", crate_version!(), env!("GIT_HASH")); + let mut options = Options::default(); let matches = App::new(crate_name!()) - .version(version_string.as_str()) + .version(version.as_str()) .author(crate_authors!("\n")) .about(crate_description!()) .arg(Arg::with_name("ref-test").long("ref-test").help("Generates ref test")) -- cgit