feat(cli): added git commit hash to version output (#2696)
This commit is contained in:
1 parent
bd484842bd
commit
f8cb07e673
1 file changed
+10
-1
@@ -13,6 +13,7 @@ pub mod translate;
|
|||||||
use crate::{custom_error, error::Result, Error};
|
use crate::{custom_error, error::Result, Error};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use html_parser::Dom;
|
use html_parser::Dom;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Display,
|
fmt::Display,
|
||||||
@@ -22,9 +23,17 @@ use std::{
|
|||||||
process::{Command, Stdio},
|
process::{Command, Stdio},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub static VERSION: Lazy<String> = 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.
|
/// Build, Bundle & Ship Dioxus Apps.
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(name = "dioxus", version)]
|
#[clap(name = "dioxus", version = VERSION.as_str())]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub action: Commands,
|
pub action: Commands,
|
||||||
|
|||||||
Reference in new issue
Block a user