Skip to content

Commit eb93460

Browse files
committed
♻️ refactor: update
1 parent e58d012 commit eb93460

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

config/config/bash/.bash_completions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
if [ -f ~/.config/bash/git-bash-completions/exec.sh ]; then
4-
source ~/.config/bash/git-bash-completions/exec.sh
3+
if [ -f "$HOME/.config/bash/git-bash-completions/exec.sh" ]; then
4+
source "$HOME/.config/bash/git-bash-completions/exec.sh"
55
fi

config/config/bash/.bash_functions

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -47,49 +47,49 @@ unshorten() {
4747
}
4848

4949
# git-open: Open Git repository in web browser
50-
git-open() {
51-
current_location="$(pwd)"
52-
working_dir=${1:-$(pwd)}
53-
working_dir="$(realpath "$working_dir")"
50+
# git-open() {
51+
# current_location="$(pwd)"
52+
# working_dir=${1:-$(pwd)}
53+
# working_dir="$(realpath "$working_dir")"
5454

55-
if ! test -d "$working_dir"; then
56-
return
57-
elif ! test -d "$working_dir/.git"; then
58-
return
59-
fi
55+
# if ! test -d "$working_dir"; then
56+
# return
57+
# elif ! test -d "$working_dir/.git"; then
58+
# return
59+
# fi
6060

61-
branch="$(git -C "$working_dir" symbolic-ref -q --short HEAD)"
61+
# branch="$(git -C "$working_dir" symbolic-ref -q --short HEAD)"
6262

63-
# Use `GitHub CLI` to open git repository
64-
if command -v gh >/dev/null 2>&1; then
65-
cd "$working_dir" && gh repo view --branch "$branch" --web
66-
cd "$current_location" || exit 0
67-
# Resolve git url
68-
else
69-
remote="$(git -C "$working_dir" config "branch.$branch.remote")"
70-
url="$(git -C "$working_dir" ls-remote --get-url "$remote")"
63+
# # Use `GitHub CLI` to open git repository
64+
# if command -v gh >/dev/null 2>&1; then
65+
# cd "$working_dir" && gh repo view --branch "$branch" --web
66+
# cd "$current_location" || exit 0
67+
# # Resolve git url
68+
# else
69+
# remote="$(git -C "$working_dir" config "branch.$branch.remote")"
70+
# url="$(git -C "$working_dir" ls-remote --get-url "$remote")"
7171

72-
if [[ "$url" =~ ^[a-z\+]+://.* ]]; then
73-
uri=${url#*://}
74-
uri=${uri#*@}
75-
domain=${uri%%/*}
76-
urlpath=${uri#*/}
72+
# if [[ "$url" =~ ^[a-z\+]+://.* ]]; then
73+
# uri=${url#*://}
74+
# uri=${uri#*@}
75+
# domain=${uri%%/*}
76+
# urlpath=${uri#*/}
7777

78-
gitprotocol=${url%%://*}
78+
# gitprotocol=${url%%://*}
7979

80-
if [[ $gitprotocol != 'https' && $gitprotocol != 'http' ]]; then
81-
domain=${domain%:*}
82-
fi
83-
else
84-
uri=${url##*@}
85-
domain=${uri%%:*}
86-
urlpath=${uri#*:}
87-
fi
88-
urlpath=${urlpath#/} urlpath=${urlpath%/} urlpath=${urlpath%.git}
89-
if [[ $gitprotocol == 'http' ]]; then protocol='http'; else protocol='https'; fi
80+
# if [[ $gitprotocol != 'https' && $gitprotocol != 'http' ]]; then
81+
# domain=${domain%:*}
82+
# fi
83+
# else
84+
# uri=${url##*@}
85+
# domain=${uri%%:*}
86+
# urlpath=${uri#*:}
87+
# fi
88+
# urlpath=${urlpath#/} urlpath=${urlpath%/} urlpath=${urlpath%.git}
89+
# if [[ $gitprotocol == 'http' ]]; then protocol='http'; else protocol='https'; fi
9090

91-
openurl="$protocol://$domain/$urlpath/tree/$branch"
92-
echo "Opening $openurl in your browser."
93-
start "$openurl"
94-
fi
95-
}
91+
# openurl="$protocol://$domain/$urlpath/tree/$branch"
92+
# echo "Opening $openurl in your browser."
93+
# start "$openurl"
94+
# fi
95+
# }

0 commit comments

Comments
 (0)