From: Oleg Broytman Date: Thu, 25 Jan 2024 17:21:00 +0000 (+0300) Subject: bin/git-open: Open browser window in private mode X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=5520c0efb11271b663f813d236699c3c90ba02a1;p=dotfiles.git bin/git-open: Open browser window in private mode --- diff --git a/bin/git-open b/bin/git-open index b25e8d9..4cf5946 100755 --- a/bin/git-open +++ b/bin/git-open @@ -1,7 +1,12 @@ #! /bin/sh +if [ "x$1" = x-p ]; then + private="-p" + shift +fi + if [ $# -ne 1 ]; then - echo "Usage: git open url_key" >&2 + echo "Usage: git open [-p] url_key" >&2 exit 1 fi @@ -13,7 +18,9 @@ fi browser_section="`git config --get web.browser`" browser_cmd="`git config --get browser.\"$browser_section\".cmd`" -if [ -z "$browser_cmd" ]; then +if [ x"$private" = x-p ]; then + browser_cmd="webbrowser -p" +elif [ -z "$browser_cmd" ]; then browser_cmd="webbrowser -n" fi diff --git a/bin/git-open-remote b/bin/git-open-remote index 45c3a7e..9aa6a84 100755 --- a/bin/git-open-remote +++ b/bin/git-open-remote @@ -1,5 +1,10 @@ #! /bin/sh +if [ "x$1" = x-p ]; then + private="-p" + shift +fi + if [ -z "$1" ]; then branch="`git rev-parse --abbrev-ref HEAD`" remote="`git config --get branch.$branch.remote`" @@ -16,4 +21,4 @@ if [ -z "$remote" ]; then exit 1 fi -exec git-open remote.$remote.url +exec git-open $private remote.$remote.url