]> Sergey Matveev's repositories - nnn.git/commitdiff
Add comment for imv command in imgview plugin. Check with which instead of version...
authorDave Snider <dave.snider@gmail.com>
Sat, 29 Aug 2020 22:56:55 +0000 (15:56 -0700)
committerGitHub <noreply@github.com>
Sat, 29 Aug 2020 22:56:55 +0000 (04:26 +0530)
* change version checks to `which` instead. add comments around imvr in linux

* add which checks for renamer and preview-tui as well

plugins/imgview
plugins/preview-tui
plugins/renamer

index 16d483be2e2e176a8643142d5460a2e5fa17b984..afc0d0feacb5922f1fafbc42ee4945c997dcca86 100755 (executable)
@@ -43,22 +43,24 @@ if uname | grep -q "Darwin"; then
     if [ -f "$1" ]; then
         open "$1" >/dev/null 2>&1 &
     fi
-elif command -v imvr >/dev/null 2>&1; then
+# `imvr` is often callable as `imv` on Linux distros
+# You might need to change the reference below
+elif which imvr >/dev/null 2>&1; then
     if [ -f "$1" ]; then
         view_dir imvr "$1" >/dev/null 2>&1 &
     elif [ -d "$1" ] || [ -h "$1" ]; then
         imvr "$1" >/dev/null 2>&1 &
     fi
-elif command -v sxiv >/dev/null 2>&1; then
+elif which sxiv >/dev/null 2>&1; then
     if [ -f "$1" ]; then
         view_dir sxiv "$1" >/dev/null 2>&1 &
     elif [ -d "$1" ] || [ -h "$1" ]; then
         sxiv -qt "$1" >/dev/null 2>&1 &
     fi
-elif command -v viu >/dev/null 2>&1; then
+elif which viu >/dev/null 2>&1; then
     viu -n "$1" | less -R
 else
-    printf "install imv/sxiv/viu"
+    printf "Please install imv/sxiv/viu and check their callable names match the plugin source"
     read -r _
     exit 2
 fi
index 8dcdb3c9340515718eea4bc82cc5aecef942883a..255c35dc279fbdeaaa5f7f4fd1c3612a47479cee 100755 (executable)
@@ -81,7 +81,7 @@ elif [ "$SPLIT" != 'h' ]; then
 fi
 
 exists() {
-    command -v "$1" >/dev/null 2>&1
+    which "$1" >/dev/null 2>&1
 }
 
 fifo_pager() {
index 4c157648a517b62927fb85cbc2b0af56f4365890..68b6ef03d7313790d4b8cbd8c93e7c936cd11b8b 100755 (executable)
 
 selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
 
-if command -v qmv >/dev/null 2>&1; then
+if which qmv >/dev/null 2>&1; then
        batchrenamesel="qmv -fdo -da"
        batchrename="qmv -fdo -a"
-elif command -v vidir >/dev/null 2>&1; then
+elif which vidir >/dev/null 2>&1; then
        batchrenamesel="vidir"
        batchrename="vidir"
 else