Print host architecture with --version

This commit is contained in:
jcamiel 2023-09-07 15:45:52 +02:00
parent ffa4052f32
commit c56bc1380e
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
2 changed files with 5 additions and 1 deletions

View File

@ -113,8 +113,9 @@ impl From<ErrorFormat> for hurl::util::logger::ErrorFormat {
fn get_version() -> String {
let libcurl_version = http::libcurl_version_info();
format!(
"{} {}\nFeatures (libcurl): {}\nFeatures (built-in): brotli",
"{} ({}) {}\nFeatures (libcurl): {}\nFeatures (built-in): brotli",
clap::crate_version!(),
libcurl_version.host,
libcurl_version.libraries.join(" "),
libcurl_version.features.join(" ")
)

View File

@ -20,6 +20,7 @@ use std::collections::HashMap;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CurlVersionInfo {
pub host: String,
pub libraries: Vec<String>,
pub features: Vec<String>,
}
@ -31,6 +32,7 @@ pub struct CurlVersionInfo {
/// - <https://github.com/curl/curl/blob/master/src/tool_help.c>
pub fn libcurl_version_info() -> CurlVersionInfo {
let version = curl::Version::get();
let host = version.host().to_string();
let mut libraries = vec![format!("libcurl/{}", version.version())];
if let Some(s) = version.ssl_version() {
libraries.push(s.to_string());
@ -117,6 +119,7 @@ pub fn libcurl_version_info() -> CurlVersionInfo {
features.sort_by_key(|k| k.to_lowercase());
CurlVersionInfo {
host,
libraries,
features,
}