diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-01 01:11:08 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-01 01:11:08 +1300 |
commit | e19bb8fb3c8350bee288327abd978a59eb3dc0f7 (patch) | |
tree | 754d2d883b27477f53f0fece44ef9edc7e4238f0 /bin/xgo.sh | |
parent | Merge branch 'release/v4.2.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-954586e6ed7dfbd525e6ec8d1adc4f0c0bc0a48e.tar.gz (sig) dotfiles-954586e6ed7dfbd525e6ec8d1adc4f0c0bc0a48e.zip |
Merge branch 'release/v4.3.0'v4.3.0
* release/v4.3.0:
Bump VERSION
Switch to using GNU Emacs on development machines
Trim some trailing whitespace
Clarify control flow in shell scripts
Add clarifying comment
Translate a short-circuit into a conditional
Add a cheeky error message to sd()
Strip trailing slashes from sd() target
Correct error message from sd()
Diffstat (limited to 'bin/xgo.sh')
-rw-r--r-- | bin/xgo.sh | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -15,7 +15,8 @@ for url do ( # If this is a GitHub or GitLab link, swap "blob" for "raw" to get the # actual file (*://github.com/*/blob/*|*://gitlab.com/*/blob/*) - url=$(printf '%s\n' "$url" | sed 's_/blob/_/raw/_') + url=$(printf '%s\n' "$url" | + sed 's_/blob/_/raw/_') ;; # Dig out the plain text for pastebin.com links @@ -38,7 +39,7 @@ for url do ( # mpv(1) (*[/.]youtube.com/watch*[?\&]t=) ;; (*[/.]youtube.com/watch*) - mpv -- "$url" && exit + exec mpv -- "$url" ;; esac @@ -54,30 +55,32 @@ for url do ( ( cd -- "$HOME"/Downloads || exit curl -O -- "$url" || exit - xpdf -- "${url##*/}" - ) && exit + exec xpdf -- "${url##*/}" + ) ;; # Open audio and video in mpv(1); force a window even for audio so I # can control it (audio/*|video/*) - mpv --force-window -- "$url" && exit + exec mpv --force-window -- "$url" ;; # If the MIME type is an image that is not a GIF, load it in feh(1) (image/gif) ;; (image/*) - curl -- "$url" | feh - && exit + exec curl -- "$url" | feh - ;; # Open plain text in a terminal view(1) (text/plain) # shellcheck disable=SC2016 - urxvt -e sh -c 'curl -- "$1" | view -' _ "$url" && exit + exec urxvt -e sh -c 'curl -- "$1" | view -' _ "$url" ;; - esac - # Otherwise, just pass it to br(1df) - br "$url" + # Otherwise, just pass it to br(1df) + (*) + exec br "$url" + ;; + esac ) & done |