fix(cli): proper version in vault info
This commit is contained in:
parent
c15052656a
commit
86c8921fdd
3 changed files with 7 additions and 12 deletions
|
@ -36,3 +36,7 @@ lazy_static! {
|
|||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
pub fn get_version() -> &'static str {
|
||||
option_env!("UPEND_VERSION").unwrap_or("unknown")
|
||||
}
|
|
@ -179,7 +179,7 @@ struct ServeArgs {
|
|||
|
||||
#[actix_web::main]
|
||||
async fn main() -> Result<()> {
|
||||
let command = Cli::command().version(option_env!("UPEND_VERSION").unwrap_or("unknown"));
|
||||
let command = Cli::command().version(crate::common::get_version());
|
||||
let args = Cli::from_arg_matches(&command.get_matches())?;
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
|
|
|
@ -832,7 +832,8 @@ pub async fn get_info(state: web::Data<State>) -> Result<HttpResponse, Error> {
|
|||
"name": state.config.vault_name,
|
||||
// "location": &*state.store.path,
|
||||
"version": format!(
|
||||
"{} / {} / {}",
|
||||
"{} (base: {}, db: {}, cli: {})",
|
||||
crate::common::get_version(),
|
||||
upend_base::common::build::PKG_VERSION,
|
||||
upend_db::common::build::PKG_VERSION,
|
||||
build::PKG_VERSION
|
||||
|
@ -970,21 +971,11 @@ mod tests {
|
|||
#[derive(Deserialize)]
|
||||
struct VaultInfo {
|
||||
name: Option<String>,
|
||||
version: String,
|
||||
desktop: bool,
|
||||
}
|
||||
let info: VaultInfo = actix_web::test::call_and_read_body_json(&app, req).await;
|
||||
|
||||
assert_eq!(info.name, Some("TEST VAULT".to_string()));
|
||||
assert_eq!(
|
||||
info.version,
|
||||
format!(
|
||||
"{} / {} / {}",
|
||||
upend_base::common::build::PKG_VERSION,
|
||||
upend_db::common::build::PKG_VERSION,
|
||||
build::PKG_VERSION
|
||||
)
|
||||
);
|
||||
assert!(!info.desktop);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue