From b6ca111a158a6df9bbba53baa29dfd2737aeb5dc Mon Sep 17 00:00:00 2001 From: pvshvp-oss Date: Sun, 12 May 2024 02:39:00 -0500 Subject: [PATCH] style: :children_crossing: Output improvements --- Cargo.toml | 2 +- paxy/src/app/config.rs | 21 ++++++--------- paxy/src/app/ui.rs | 59 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bf04a50..509bce6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ homepage = "https://pax-hub.github.io/" authors = [ "shivanandvp ", "lylythechosenone", - "ferriswastaken", + "ferriswastaken - Ishaan S ", "flyingcakes85", ] keywords = ["package", "package-manager", "paxy", "packager"] diff --git a/paxy/src/app/config.rs b/paxy/src/app/config.rs index 4a66df0..66870bf 100644 --- a/paxy/src/app/config.rs +++ b/paxy/src/app/config.rs @@ -103,20 +103,15 @@ fn candidate_log_dirpath(preferred_log_dirpath: Option) -> Result Result { - let xdg_app_dirs = - directories::BaseDirs::new().context(RetreiveLoggingUserAppBaseDirectoriesSnafu {})?; - fs::create_dir_all(xdg_app_dirs.data_dir()).context(CreateLogDirectorySnafu { - path: { - let mut state_dirpath = xdg_app_dirs - .data_dir() - .to_owned(); - state_dirpath.push(*app::APP_NAME); - state_dirpath - }, - })?; - Ok(xdg_app_dirs + let mut log_dirpath = directories::BaseDirs::new() + .context(RetreiveLoggingUserAppBaseDirectoriesSnafu {})? .data_dir() - .to_owned()) + .to_path_buf(); + log_dirpath.push(*app::APP_NAME); + fs::create_dir_all(&log_dirpath).context(CreateLogDirectorySnafu { + path: log_dirpath.clone(), + })?; + Ok(log_dirpath) } #[derive(Default, Clone, Debug, Serialize, Deserialize)] diff --git a/paxy/src/app/ui.rs b/paxy/src/app/ui.rs index e7f61fa..10491eb 100644 --- a/paxy/src/app/ui.rs +++ b/paxy/src/app/ui.rs @@ -32,12 +32,23 @@ fn emit_welcome_messages() { "Paxy".bold(), "A package manager that gets out of your way".magenta() ); - tracing::debug!( - "{} {} {}", - console::Emoji("✉️", ""), - "shivanandvp".italic(), - "".italic() - ); + + let crate_authors = clap::crate_authors!("\n") + .split("\n") + .fold(String::from(""), |mut acc, author| { + acc.push_str( + console::Emoji("✉️", "") + .to_string() + .as_str(), + ); + acc.push_str(" "); + acc.push_str(author); + acc.push_str("\n"); + + acc + }); + + tracing::debug!("{}", crate_authors.italic()); } fn emit_diagnostic_messages(config: &ConfigTemplate) { @@ -67,13 +78,45 @@ fn emit_diagnostic_messages(config: &ConfigTemplate) { console::Emoji("✅", ""), ); + let config_filepaths = config + .config_filepaths + .iter() + .fold(String::from(""), |mut acc: String, config_filepath| { + if config_filepath.is_file() { + acc.push_str( + config_filepath + .to_string_lossy() + .green() + .to_string() + .as_str(), + ); + acc.push_str(", "); + } else { + acc.push_str( + config_filepath + .to_string_lossy() + .dimmed() + .to_string() + .as_str(), + ); + acc.push_str( + ", ".dimmed() + .to_string() + .as_str(), + ); + } + + acc + }); + tracing::debug!( - "{} {} {:?}", + "{} {} [{}]", console::Emoji("📂", ""), "Config Filepath(s):".magenta(), - config.config_filepaths, + config_filepaths, ); + tracing::debug!( "{} {} {:?}", console::Emoji("📂", ""),