mirror of
https://github.com/denisidoro/navi
synced 2024-11-24 20:43:06 +00:00
Fix path for downloaded cheats (#493)
This commit is contained in:
parent
56ae9b880f
commit
d550b29fb0
4 changed files with 19 additions and 16 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -308,7 +308,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "navi"
|
||||
version = "2.15.0"
|
||||
version = "2.15.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "navi"
|
||||
version = "2.15.0"
|
||||
version = "2.15.1"
|
||||
authors = ["Denis Isidoro <denis_isidoro@live.com>"]
|
||||
edition = "2018"
|
||||
description = "An interactive cheatsheet tool for the command-line"
|
||||
|
|
|
@ -116,7 +116,7 @@ pub fn add(uri: String, finder: &FinderChoice) -> Result<(), Error> {
|
|||
};
|
||||
|
||||
let to_folder = {
|
||||
let mut p = cheat_pathbuf.clone();
|
||||
let mut p = cheat_pathbuf;
|
||||
p.push(format!("{}__{}", user, repo));
|
||||
p
|
||||
};
|
||||
|
@ -127,7 +127,9 @@ pub fn add(uri: String, finder: &FinderChoice) -> Result<(), Error> {
|
|||
p.push(file);
|
||||
p
|
||||
};
|
||||
let filename = file.replace("/", "__");
|
||||
let filename = file
|
||||
.replace(&format!("{}/", &tmp_path_str), "")
|
||||
.replace("/", "__");
|
||||
let to = {
|
||||
let mut p = to_folder.clone();
|
||||
p.push(filename);
|
||||
|
@ -146,9 +148,8 @@ pub fn add(uri: String, finder: &FinderChoice) -> Result<(), Error> {
|
|||
filesystem::remove_dir(&tmp_pathbuf)?;
|
||||
|
||||
eprintln!(
|
||||
"The following .cheat files were imported successfully:\n{}\n\nThey are now located at {}/{}",
|
||||
"The following .cheat files were imported successfully:\n{}\n\nThey are now located at {}",
|
||||
files,
|
||||
pathbuf_to_string(&cheat_pathbuf)?,
|
||||
pathbuf_to_string(&to_folder)?
|
||||
);
|
||||
|
||||
|
|
22
tests/run
22
tests/run
|
@ -111,8 +111,10 @@ _integration() {
|
|||
sleep 1
|
||||
tmux send-key -t ci "Enter"
|
||||
|
||||
echoerr "Checking paths..."
|
||||
sleep 2
|
||||
cat "$log_file" | tail -n10 | grep -q "/navi"
|
||||
local -r downloaded_path="$(cat "$log_file" | grep 'They are now located at' | sed 's/They are now located at //')"
|
||||
ls "$downloaded_path" | grep -q '^pkg_mgr__brew.cheat$'
|
||||
}
|
||||
|
||||
if ! command_exists fzf; then
|
||||
|
@ -140,19 +142,19 @@ for i in $(_get_tests "$filter"); do
|
|||
test::run "$query" _navi_cases_test "$query" "$expected"
|
||||
done
|
||||
|
||||
test::set_suite "3rd party"
|
||||
test::run "tldr" _navi_tldr
|
||||
test::run "cheatsh" _navi_cheatsh
|
||||
|
||||
test::set_suite "widget"
|
||||
test::run "bash" _navi_widget "bash"
|
||||
test::run "zsh" _navi_widget "zsh"
|
||||
test::run "zsh" _navi_widget "fish"
|
||||
|
||||
test::set_suite "info"
|
||||
test::run "cheats_path" _navi_cheatspath
|
||||
|
||||
test::set_suite "integration"
|
||||
test::run "welcome->pwd" _integration
|
||||
|
||||
test::set_suite "widget"
|
||||
test::run "bash" _navi_widget "bash"
|
||||
test::run "zsh" _navi_widget "zsh"
|
||||
test::run "zsh" _navi_widget "fish"
|
||||
|
||||
test::set_suite "3rd party"
|
||||
test::run "tldr" _navi_tldr
|
||||
test::run "cheatsh" _navi_cheatsh
|
||||
|
||||
test::finish
|
||||
|
|
Loading…
Reference in a new issue