Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion git-open.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,18 @@ elif [ $# = 2 ]; then
repo=$2
fi

# Detect the appropriate open command based on the operating system
if command -v xdg-open >/dev/null 2>&1; then
open_cmd="xdg-open"
elif command -v open >/dev/null 2>&1; then
open_cmd="open"
else
echo "Error: No suitable open command found (tried xdg-open and open)"
exit 1
fi

if [ -n "${DEBUG:-}" ]; then
echo $baseurl/$username/$repo
else
open $baseurl/$username/$repo
$open_cmd $baseurl/$username/$repo
fi