commit 92f6a83109c63017e549b939d1c7125a40778dc3 parent b17bba1a6c660272fbcf920875dca6ce92118edf Author: gearsix <gearsix@tuta.io> Date: Sat, 7 Jan 2023 15:51:22 +0000 made openurl macos compatible Diffstat:
M | src/posix/openurl.sh | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/posix/openurl.sh b/src/posix/openurl.sh @@ -10,9 +10,11 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then exit fi -for f in $@; do - for url in "$(grep -o -E 'https?://[^"]+' $f)"; do - xdg-open "$url"; - done +for f in "$@"; do + while read -r url; do + cmd=$(open "$url" | grep -q 'https?://(^")+' | tr -d '\r') + if [ "$(uname)" != "Darwin" ]; then cmd="xdg-"+$cmd; fi + $cmd + done < "$f" done