From f8cb07e67343c1d33be73c606a66c92ba29e0731 Mon Sep 17 00:00:00 2001 From: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com> Date: Thu, 25 Jul 2024 01:44:45 +0500 Subject: [PATCH] feat(cli): added git commit hash to version output (#2696) --- packages/cli/src/cli/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/cli/mod.rs b/packages/cli/src/cli/mod.rs index 6f0caf96a..4ce83e12a 100644 --- a/packages/cli/src/cli/mod.rs +++ b/packages/cli/src/cli/mod.rs @@ -13,6 +13,7 @@ pub mod translate; use crate::{custom_error, error::Result, Error}; use clap::{Parser, Subcommand}; use html_parser::Dom; +use once_cell::sync::Lazy; use serde::Deserialize; use std::{ fmt::Display, @@ -22,9 +23,17 @@ use std::{ process::{Command, Stdio}, }; +pub static VERSION: Lazy = Lazy::new(|| { + format!( + "{} ({})", + crate::dx_build_info::PKG_VERSION, + crate::dx_build_info::GIT_COMMIT_HASH_SHORT.unwrap_or("was built without git repository") + ) +}); + /// Build, Bundle & Ship Dioxus Apps. #[derive(Parser)] -#[clap(name = "dioxus", version)] +#[clap(name = "dioxus", version = VERSION.as_str())] pub struct Cli { #[clap(subcommand)] pub action: Commands,