dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit c2916816ef3b1eb2326330c5ad060a60dd82ca84
parent 4bca9406798d67ede0fa0a8b9311a6aa953a0042
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 10 Jul 2021 19:55:54 +0100

.s/b/plumb: improve file checking

Diffstat:
M.scripts/bin/plumb | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/.scripts/bin/plumb b/.scripts/bin/plumb @@ -54,7 +54,14 @@ replace(){ } isfile(){ - [ -f "$1" ] + [ -z "$1" ] && { + [ -f "$arg" ] + return $? + } + [ -n "$1" ] && { + [ -f "$1" ] + return $? + } } hascmd(){ @@ -121,25 +128,31 @@ do # local files now fmatches "PGP.*public.*key" && + isfile && plumb terminal "gpg --import $arg; sleep 5" matches ".*\.(epub|ps|eps|pdf|dvi|djvu)$" || fmatches "pdf|postscript" && + isfile && plumb gui 'zathura $arg' matches ".*\.(mkv|mp4|avi|webm|ogg|ogv|gifv|mp3|mp4|opus|flac|ape|m3u|m3u8)$" || fmatches "video|matroska|audio|sound" && + isfile && plumb terminal 'mpv --pause $arg' matches ".*\.(jpe?g|gif|tiff?|ppm|bit|bmp|png|xpm)$" || fmatches "image" && + isfile && plumb gui 'sxiv $arg' matches "\.?/.*\.[0-9]p?$" && fmatches "(roff|preprocessor)" && + isfile && plumb terminal 'man $arg' matches "\.(gph|gophermap)$|(^|/)gophermap$" && + isfile && plumb terminal 'cgo -f $arg' # numbered file @@ -149,7 +162,7 @@ do # catch all for files matches ".*" && - isfile $arg && + isfile && plumb terminal 'vim $arg' # include files