From: Oleg Broytman Date: Mon, 22 Jan 2024 08:19:57 +0000 (+0300) Subject: Feat(git-open): Open browser window in private mode X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=d6c1b108377841d252eb03dc2746adcac3c20df5;p=git-scripts.git Feat(git-open): Open browser window in private mode --- diff --git a/git-open b/git-open index 743707c..4cf5946 100755 --- a/git-open +++ b/git-open @@ -1,12 +1,16 @@ #! /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 -else - url_key="$1" fi +url_key="$1" if [ -z "$url_key" ]; then echo "Usage: git open url_key" >&2 exit 1 @@ -14,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/git-open-remote b/git-open-remote index 45c3a7e..9aa6a84 100755 --- a/git-open-remote +++ b/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