Update 2024-10-24 00:06 OpenBSD/amd64-t14
This commit is contained in:
parent
de5b108398
commit
bcacac1029
21
.bin/nnn.sh
21
.bin/nnn.sh
@ -1,4 +1,4 @@
|
||||
#!/bin/ksh
|
||||
#!/bin/ksh -x
|
||||
|
||||
f="$1"
|
||||
|
||||
@ -12,7 +12,6 @@ fi
|
||||
# SSH
|
||||
###################################################
|
||||
|
||||
# SSH
|
||||
if print "$f" | egrep -qi '^shell:|^ushell:|^cvs:|^home:';
|
||||
then
|
||||
_server=${f%%:*}
|
||||
@ -24,6 +23,7 @@ fi
|
||||
###################################################
|
||||
# TRY TO FIND MIME TYPE
|
||||
###################################################
|
||||
|
||||
if print "$f" | egrep -qi '^http[s]{0,1}://';
|
||||
then
|
||||
MIME="$(webmime "$f")"
|
||||
@ -45,13 +45,14 @@ fi
|
||||
###################################################
|
||||
# TRANSLATE MIME TYPES TO EXTENSIONS
|
||||
###################################################
|
||||
|
||||
case "$MIME" in
|
||||
# full qualified
|
||||
application/ogg) EXT=ogg; ;;
|
||||
application/pdf) EXT=pdf; ;;
|
||||
application/postscript) EXT=ps; ;;
|
||||
application/vnd.oasis.opendocument.*) EXT=docx; ;;
|
||||
audio/mpeg) EXT=mpg; ;;
|
||||
audio/mpeg) EXT=mp3; ;;
|
||||
audio/midi) EXT=midi; ;;
|
||||
image/webp) EXT=webp; ;;
|
||||
application/x-gzip) EXT=gz; ;;
|
||||
@ -72,7 +73,7 @@ case "$EXT" in
|
||||
docx) EXEC="libreoffice"; ;;
|
||||
flv) EXEC="mpv"; ;;
|
||||
m2ts) EXEC="mpv"; ;;
|
||||
mp3) EXEC_TERM="aplay"; ;;
|
||||
mp3) EXEC="mpv"; ;;
|
||||
mp4) EXEC="mpv"; ;;
|
||||
out) EXEC="kdump -RTf"; ;;
|
||||
sid) EXEC="sidplay"; ;;
|
||||
@ -80,11 +81,19 @@ case "$EXT" in
|
||||
txt) EXEC="vim"; ;;
|
||||
webm) EXEC="mpv"; ;;
|
||||
xlsx) EXEC="libreoffice"; ;;
|
||||
jpg) EXEC="nsxiv"; ;;
|
||||
generic_text) EXEC="vim"; ;;
|
||||
generic_video) EXEC="mpv"; ;;
|
||||
generic_image) EXEC="nsxiv"; EXEC_HTTP="$BROWSER"; ;;
|
||||
generic_audio) EXEC="mpv"; ;;
|
||||
esac
|
||||
echo "TYPE=$TYPE | MIME=$MIME | EXT=.$EXT | EXEC=$EXEC"
|
||||
|
||||
[ ! -z "$EXEC" ] && exec $EXEC "$f"
|
||||
echo "TYPE=$TYPE | MIME=$MIME | EXT=$EXT | EXEC=$EXEC"
|
||||
|
||||
case "$TYPE" in
|
||||
gopher) exec $EXEC_GOPHER "$f"; ;;
|
||||
http) exec $EXEC_HTTP "$f"; ;;
|
||||
file) exec $EXEC "$f"; ;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user