use const format for version string
This commit is contained in:
Generated
+27
@@ -76,6 +76,26 @@ dependencies = [
|
|||||||
"os_str_bytes",
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const_format"
|
||||||
|
version = "0.2.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e"
|
||||||
|
dependencies = [
|
||||||
|
"const_format_proc_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const_format_proc_macros"
|
||||||
|
version = "0.2.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@@ -192,6 +212,7 @@ dependencies = [
|
|||||||
"alpm",
|
"alpm",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
"const_format",
|
||||||
"pacdef_macros",
|
"pacdef_macros",
|
||||||
"path-absolutize",
|
"path-absolutize",
|
||||||
"regex",
|
"regex",
|
||||||
@@ -372,6 +393,12 @@ version = "1.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ categories = ["command-line-utilities"]
|
|||||||
alpm = "2.2"
|
alpm = "2.2"
|
||||||
anyhow = {workspace = true}
|
anyhow = {workspace = true}
|
||||||
clap = "4.1"
|
clap = "4.1"
|
||||||
|
const_format = { version = "0.2", default-features = false }
|
||||||
path-absolutize = "3.0"
|
path-absolutize = "3.0"
|
||||||
regex = "1.7"
|
regex = "1.7"
|
||||||
termios = "0.3"
|
termios = "0.3"
|
||||||
@@ -23,3 +24,4 @@ serde_derive = "1.0"
|
|||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
||||||
pacdef_macros = {path = "../pacdef_macros", version = "0.1"}
|
pacdef_macros = {path = "../pacdef_macros", version = "0.1"}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use anyhow::{anyhow, bail, ensure, Context, Result};
|
use anyhow::{anyhow, bail, ensure, Context, Result};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
use const_format::formatcp;
|
||||||
|
|
||||||
use crate::action::*;
|
use crate::action::*;
|
||||||
use crate::args;
|
use crate::args;
|
||||||
@@ -338,11 +339,12 @@ fn show_error(error: &anyhow::Error, backend: &dyn Backend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const fn get_version_string() -> &'static str {
|
pub const fn get_version_string() -> &'static str {
|
||||||
concat!(
|
const VERSION: &str = concat!("pacdef, version: ", env!("CARGO_PKG_VERSION"));
|
||||||
"pacdef, version: ",
|
const HASH: &str = env!("GIT_HASH");
|
||||||
env!("CARGO_PKG_VERSION"),
|
|
||||||
" (",
|
if HASH.is_empty() {
|
||||||
env!("GIT_HASH"),
|
VERSION
|
||||||
")",
|
} else {
|
||||||
)
|
formatcp!("{VERSION} ({HASH})")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user