]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(git-open): Open browser window in private mode
authorOleg Broytman <phd@phdru.name>
Mon, 22 Jan 2024 08:19:57 +0000 (11:19 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 22 Jan 2024 08:19:57 +0000 (11:19 +0300)
git-open
git-open-remote

index 743707ca70086f6691b0e1c1be96285675cfd65a..4cf59467c6de536417a0875dfe016c3201614b67 100755 (executable)
--- 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
 
index 45c3a7ea8136d6ed137889cc71fa76de12921c74..9aa6a849f6e56d1b2182b478f60ec8eff37bbebd 100755 (executable)
@@ -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