From 1d895690f81f2cb3a308416c29b280e91e681e36 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 8 Jun 2010 00:40:43 +0200 Subject: preview: renamed script to "scripts/scope.sh" --- ranger/defaults/options.py | 2 +- ranger/ext/preview.sh | 21 --------------------- ranger/scripts/scope.sh | 22 ++++++++++++++++++++++ 3 files changed, 23 insertions(+), 22 deletions(-) delete mode 100755 ranger/ext/preview.sh create mode 100644 ranger/scripts/scope.sh diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index feb02a58..4ff774c6 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -40,7 +40,7 @@ hidden_filter = regexp( show_hidden = False # Which script is used to generate file previews? -preview_script = relpath('ext/preview.sh') # relative to rangers path +preview_script = relpath('scripts/scope.sh') # relative to rangers path # Show dotfiles in the bookmark preview box? show_hidden_bookmarks = True diff --git a/ranger/ext/preview.sh b/ranger/ext/preview.sh deleted file mode 100755 index 80186e4d..00000000 --- a/ranger/ext/preview.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -mimetype=$(file --mime-type -Lb "$1") -basetype=$(echo "$mimetype" | grep -o '^[^/]\+') -extension=$(echo "$1" | grep '\.' | grep -o '[^.]\+$') - -case "$basetype" in - text) - highlight --ansi "$1" || cat "$1" - exit 0;; - image) - img2txt "$1" || exit 1 - exit 0;; -esac - -case "$extension" in - zip|gz) - atool -l "$1" - exit 0;; -esac - -exit 1 diff --git a/ranger/scripts/scope.sh b/ranger/scripts/scope.sh new file mode 100644 index 00000000..998476dc --- /dev/null +++ b/ranger/scripts/scope.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# This script is responsible to generate the previews for ranger. +mimetype=$(file --mime-type -Lb "$1") +basetype=$(echo "$mimetype" | grep -o '^[^/]\+') +extension=$(echo "$1" | grep '\.' | grep -o '[^.]\+$') + +case "$basetype" in + text) + highlight --ansi "$1" || cat "$1" + exit 0;; + image) + img2txt "$1" || exit 1 + exit 0;; +esac + +case "$extension" in + zip|gz) + atool -l "$1" + exit 0;; +esac + +exit 1 -- cgit 1.4.1-2-gfad0