about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2018-11-24 15:37:23 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2018-11-24 15:38:09 +0100
commitbae44ae3c7440c00acf65ba4c26a0fd2a0f78c3a (patch)
tree6e6f28d3925207b892ca931e55f966ec0894ffe1
parent1ca1255a3cf26eb646fca75b5388b2c645fdf466 (diff)
downloadranger-bae44ae3c7440c00acf65ba4c26a0fd2a0f78c3a.tar.gz
scope.sh: Format JSON with either jq or json.tool
Closes #1383.
-rwxr-xr-xranger/data/scope.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 13a25b45..8e0a0f6d 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -83,6 +83,11 @@ handle_extension() {
             lynx -dump -- "${FILE_PATH}" && exit 5
             elinks -dump "${FILE_PATH}" && exit 5
             ;; # Continue with next handler on failure
+        # JSON
+        json)
+            jq --color-output . "${FILE_PATH}" && exit 5
+            python -m json.tool -- "${FILE_PATH}" && exit 5
+            ;;
     esac
 }
 
ref='#n124'>124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140