diff --git a/src/commands/repo/list.rs b/src/commands/repo/list.rs index 0ea3be9..19dc8ba 100644 --- a/src/commands/repo/list.rs +++ b/src/commands/repo/list.rs @@ -2,7 +2,7 @@ use crate::filesystem::local_cheatsheet_repositories; use crate::libs::terminal::hyperlink; pub fn main() { - let (cheats_repos, _) = local_cheatsheet_repositories(); + let (cheats_repos, cheats_paths) = local_cheatsheet_repositories(); // Now that we have our list of cheatsheet repositories, we loop through them // Two behaviours: @@ -19,6 +19,7 @@ pub fn main() { // The list shouldn't be empty eprintln!("You have locally available the following cheatsheet repositories: \n"); + let mut i: usize = 0; for cheat_repo in cheats_repos { let content = if cheat_repo.starts_with("https://") { // If the URL is using the HTTPS scheme, we use a hyperlink @@ -26,9 +27,10 @@ pub fn main() { hyperlink::new(&cheat_repo, &cheat_repo) } else { - cheat_repo.to_owned() + hyperlink::new(&format!("file://{}", &cheats_paths[i]), &cheat_repo) }; eprintln!("- {}", content); + i += 1; } }