From cfd601470b1697113d311bf6b934bc99488e2e6f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 11 Feb 2011 21:18:24 +0100 Subject: [PATCH] lessfilter: Add, help filer for lesspipe. Colors diff and patch files and displays directory contents. Also update setup.sh. --- lessfilter | 21 +++++++++++++++++++++ setup.sh | 1 + 2 files changed, 22 insertions(+) create mode 100755 lessfilter diff --git a/lessfilter b/lessfilter new file mode 100755 index 0000000..3570c79 --- /dev/null +++ b/lessfilter @@ -0,0 +1,21 @@ +#!/bin/sh + +case "$1" in + # Color diff files. + *.diff | *.patch) + < "$1" colordiff + ;; + *) + # Display directory contents. + if [ -d "$1" ]; then + echo "=> Contents of $1:" + ls "$1" + exit 0 + fi + + # We don't handle this format. + exit 1 +esac + +# No further processing by lesspipe necessary. +exit 0 diff --git a/setup.sh b/setup.sh index 4318125..9137fa6 100755 --- a/setup.sh +++ b/setup.sh @@ -53,6 +53,7 @@ link zsh/rc ~/.zshrc link zsh/logout ~/.zlogout # Link setup for additional files. +link lessfilter ~/.lessfilter if installed colordiff; then link colordiffrc ~/.colordiffrc fi -- 2.45.2