mirror of
https://github.com/denisidoro/navi.git
synced 2026-01-23 02:14:19 +00:00
Added the use of the file protocol to have a local hyperlink when confronted with a non HTTPS URI.
Signed-off-by: alexis-opolka <53085471+alexis-opolka@users.noreply.github.com>
This commit is contained in:
parent
122f06ed9c
commit
79ab8525f2
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue