about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-28 15:53:11 +0200
committerjakanakae-envangel <jakanakaevangeli@chiru.no>2018-08-28 15:53:11 +0200
commitd062ce4b0b4a8ca75c5bb7d27a35dc0471718d2c (patch)
treee1e24e5b03b1a6ecb07b5ac1a4856c8222b0ceff
parent1e8dbdea782bf4928f8df7ff1768b1fa646a3a5c (diff)
downloadranger-d062ce4b0b4a8ca75c5bb7d27a35dc0471718d2c.tar.gz
scope.sh: Simplify exit status checking
-rwxr-xr-xranger/data/scope.sh21
1 files changed, 7 insertions, 14 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index c0847551..b516904f 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -129,24 +129,17 @@ handle_image() {
         #     application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
         #     local fn=""
         #     local bsd=""
-        #     local zip=""; local rar=""; local z7=""; local tar=""
-        #     case "${MIMETYPE}" in
+        #     local zip=""; local rar=""; local tar=""
+        #     case "${mimetype}" in
         #         application/zip) zip=1 ;;
         #         application/x-rar) rar=1 ;;
-        #         application/x-7z-compressed) z7=1 ;;
+        #         application/x-7z-compressed) ;;
         #         *) tar=1 ;;
         #     esac
-        #     [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}")
-        #     [ $? != 0 ] && bsd=1 && fn=$(bsdtar --list --file "${FILE_PATH}")
-        #     [ $? != 0 ] && [ "$bsd" ] && bsd="" && [ "$tar" -o "$z7"] && return
-        #     if [ -z "$bsd" ] && [ -z "$tar" ]; then
-        #         if [ "$rar" ]; then
-        #             fn=$(unrar lb -p- -- "${FILE_PATH}")
-        #         elif [ "$zip" ]; then
-        #             fn=$(zipinfo -1 -- "${FILE_PATH}")
-        #         fi
-        #         [ $? != 0 ] && return
-        #     fi
+        #     { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
+        #     { bsd=1 && fn=$(bsdtar --list --file "${FILE_PATH}"); } || \
+        #     { bsd="" && [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
+        #     { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
         #
         #     fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
         #             [ print(l, end='') for l in sys.stdin if \