Skip to content

Commit

Permalink
style: 🚸 Output improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pvshvp-oss committed May 12, 2024
1 parent 6bc0607 commit b6ca111
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ homepage = "https://pax-hub.github.io/"
authors = [
"shivanandvp <pvshvp.oss@gmail.com, shivanandvp@rebornos.org>",
"lylythechosenone",
"ferriswastaken",
"ferriswastaken - Ishaan S <ishaans.code@gmail.com>",
"flyingcakes85",
]
keywords = ["package", "package-manager", "paxy", "packager"]
Expand Down
21 changes: 8 additions & 13 deletions paxy/src/app/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,15 @@ fn candidate_log_dirpath(preferred_log_dirpath: Option<PathBuf>) -> Result<PathB
}

fn fallback_log_dirpath() -> Result<PathBuf, Error> {
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)]
Expand Down
59 changes: 51 additions & 8 deletions paxy/src/app/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
"<pvshvp.oss@gmail.com, shivanandvp@rebornos.org>".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) {
Expand Down Expand Up @@ -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("📂", ""),
Expand Down

0 comments on commit b6ca111

Please sign in to comment.