upend/cli/src/common.rs

31 lines
860 B
Rust

use constcat::concat;
use lazy_static::lazy_static;
use shadow_rs::shadow;
shadow!(build);
#[cfg(not(debug_assertions))]
pub const RESOURCE_PATH: &str = "../share/upend";
#[cfg(debug_assertions)]
pub const RESOURCE_PATH: &str = "./tmp/resources";
pub const WEBUI_PATH: &str = concat!(RESOURCE_PATH, "/webui");
lazy_static! {
static ref APP_USER_AGENT: String = format!("upend / {}", build::PKG_VERSION);
pub static ref REQWEST_CLIENT: reqwest::blocking::Client = reqwest::blocking::Client::builder()
.user_agent(APP_USER_AGENT.as_str())
.build()
.unwrap();
pub static ref REQWEST_ASYNC_CLIENT: reqwest::Client = reqwest::Client::builder()
.user_agent(APP_USER_AGENT.as_str())
.build()
.unwrap();
}
pub fn get_version() -> &'static str {
option_env!("UPEND_VERSION").unwrap_or("unknown")
}