From bf14a7e72e7c03673949388365744f26e227ec83 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 22 Jun 2010 11:27:21 +0200 Subject: data/scope.sh: added lynx --- README | 1 + ranger/data/scope.sh | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README b/README index 7a293b97..d92543f7 100644 --- a/README +++ b/README @@ -54,6 +54,7 @@ For scope.sh: (enhanced file previews) * img2txt (from caca-utils) for previewing images * highlight for syntax highlighting of code * atool for previews of archives +* lynx or elinks for previews of html pages Getting Started diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index ad14f5e5..ef5f8ff4 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -13,19 +13,27 @@ mimetype=$(file --mime-type -Lb "$1") extension=$(echo "$1" | grep '\.' | grep -o '[^.]\+$') +case "$extension" in + # Archive extensions: + tar|gz|tgz|bz|tbz|bz2|tbz2|Z|tZ|lzo|tzo|lz|tlz|xz|txz|7z|t7z|\ + zip|jar|war|rar|lha|lzh|alz|ace|a|arj|arc|rpm|cab|lzma|rz|cpio) + atool -l "$1" || exit 1 + exit 0;; + # HTML Pages: + htm|html|xhtml) + lynx -dump "$1" || elinks -dump "$1" || exit 1 + exit 0;; +esac + case "$mimetype" in - text/*) + # Syntax highlight for text files: + text/* | */xml) highlight --ansi "$1" || cat "$1" || exit 1 exit 0;; + # Ascii-previews of images: image/*) img2txt "$1" || exit 1 exit 0;; esac -case "$extension" in - zip|gz) - atool -l "$1" || exit 1 - exit 0;; -esac - exit 1 -- cgit 1.4.1-2-gfad0