This commit is contained in:
Denis Isidoro 2020-03-16 08:13:55 -03:00
parent 503c6b54a3
commit dd6c54f089
2 changed files with 16 additions and 4 deletions

View file

@ -113,6 +113,18 @@ get_shell() {
echo $SHELL | xargs basename
}
installation_finish_instructions() {
local -r shell="$(get_shell)"
echoerr -e "Finished. To call navi, restart your shell or reload the config file:\n source ~/.${shell}rc"
local code
if [[ $shell = "zsh" ]]; then
code="navi widget ${shell} | source"
else
code="source <(navi widget ${shell})"
fi
echoerr -e "\nTo add the Ctrl-G keybinding, add the following to ~/.${shell}rc:\n ${code}"
}
install_navi() {
export SOURCE_DIR="${SOURCE_DIR:-"$(get_source_dir)"}"
export BIN_DIR="${BIN_DIR:-"$(get_bin_dir)"}"

View file

@ -2,7 +2,7 @@ pub fn meta(uri: &str) -> (String, String, String) {
let actual_uri = if uri.contains("://") {
uri.to_string()
} else if uri.contains('@') {
uri.replace("git@", "https://").replace(':', "/")
uri.replace(':', "/").replace("git@", "https://")
} else {
format!("https://github.com/{}", uri)
};
@ -29,9 +29,9 @@ mod tests {
#[test]
fn test_meta_github_ssh() {
let (actual_uri, user, repo) = meta("git@github.com:denisidoro/navi.git");
assert_eq!(actual_uri, "https://github.com/denisidoro/navi".to_string());
assert_eq!(actual_uri, "https://github.com/denisidoro/navi.git".to_string());
assert_eq!(user, "denisidoro".to_string());
assert_eq!(repo.contains("navi"), true);
assert_eq!(repo, "navi".to_string());
}
#[test]
@ -39,6 +39,6 @@ mod tests {
let (actual_uri, user, repo) = meta("https://gitlab.com/user/repo.git");
assert_eq!(actual_uri, "https://gitlab.com/user/repo.git".to_string());
assert_eq!(user, "user".to_string());
assert_eq!(repo.contains("repo"), true);
assert_eq!(repo, "repo".to_string());
}
}