commit 5a8354dd9b52d847cb0edea9a2f63775489b9694
parent 9adc180fe25ebe5b0aacc205064bae713d33fb4d
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Fri, 2 Oct 2020 21:26:23 +0200
open: fix an error
Also move to open instead of xdg-open for everything.
Former-commit-id: c01aa951708ff030dd041ec04b5dfcc8bc86503d
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/git/gitconfig b/git/gitconfig
@@ -63,7 +63,7 @@
fuckitall = reset --hard origin/master
ssh = "!git remote get-url origin | sed -E 's|^https?://([^/]+)/(.+)|git@\\1:\\2|' | tr -d '\n'"
home = "!git remote get-url origin | sed -E 's|^git@([^:]+):|https://\\1/|' | tr -d '\n'"
- open = "!xdg-open $(git home)"
+ open = "!open $(git home)"
dad = "!curl https://icanhazdadjoke.com/ && echo && git add"
reignore = "!git rm -r --cached .; git add ."
rb = "rebase --committer-date-is-author-date"
diff --git a/scripts/open b/scripts/open
@@ -1,12 +1,11 @@
#!/bin/sh
-os=$(uname -s | tr '[:upper:]' '[:lower:]')
-
+set -x
PARAMS=""
-while [ $(("$#")) -ne 0 ]; do
+while [ $(($#)) -ne 0 ]; do
case "$1" in
-g|--background)
background=1
- shift 2
+ shift
;;
-h|--help)
echo "Usage:"
@@ -30,16 +29,16 @@ done
eval set -- "$PARAMS"
background=${background:-0}
+os=$(uname -s | tr '[:upper:]' '[:lower:]')
case $os in
linux*)
# not sure how backgrounding is handled with xdg-open
command xdg-open "$@"
;;
darwin*)
- if [ $background -eq 1 ]; then open -g "$@"
- else open "$@"
+ if [ $background -eq 1 ]; then /usr/bin/open -g "$@"
+ else /usr/bin/open "$@"
fi
- /usr/bin/open "$@"
;;
msys*|cygwin*|mingw*|nt|win*)
printf "Windows not supported yet.\n"