]> git.phdru.name Git - dotfiles.git/commitdiff
bin/git-open: Open browser window in private mode
authorOleg Broytman <phd@phdru.name>
Thu, 25 Jan 2024 17:21:00 +0000 (20:21 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 25 Jan 2024 17:21:00 +0000 (20:21 +0300)
bin/git-open
bin/git-open-remote

index b25e8d9905de15a638a76c50e6160abdf161dfbe..4cf59467c6de536417a0875dfe016c3201614b67 100755 (executable)
@@ -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
 
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