fix: avoid polluting main shell

This commit is contained in:
2024-08-14 15:07:58 +03:00
parent 0b07f460af
commit e18cb46b8f
3 changed files with 14 additions and 1 deletions

View File

@@ -298,3 +298,9 @@ case $1 in
git_open $@
;;
esac
if [[ -z "$__UNLOAD_PATH" ]]; then
__UNLOAD_PATH="${0:A:h}/unload.zsh"
fi
source "$__UNLOAD_PATH"

View File

@@ -4,7 +4,9 @@ if [[ -z "$TERM" ]]; then
export TERM=xterm-256color
fi
### Setup
__UTILS_PATH="${0:A:h}/utils.mock.zsh" source "${0:A:h}/../git-open.zsh"
__UTILS_PATH="${0:A:h}/utils.mock.zsh" \
__UNLOAD_PATH="/dev/null" \
source "${0:A:h}/../git-open.zsh"
assert_value() {
local expected="$1"

5
unload.zsh Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env zsh
unset -f git_open git_open_project git_open_branch git_open_file git_open_commit \
git_open_pr_list git_open_new_pr git_open_pipelines uriencode git_get_remote \
git_get_repo_path git_get_remote_type open_url