Bug 81969 - Add .tbz to lesspipe.sh and implement lesspipe.d
Summary: Add .tbz to lesspipe.sh and implement lesspipe.d
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: less
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-01-15 21:19 UTC by Ville Skyttä
Modified: 2007-04-18 16:50 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-11-16 15:17:32 UTC
Embargoed:


Attachments (Terms of Use)

Description Ville Skyttä 2003-01-15 21:19:05 UTC
lesspipe.sh doesn't currently handle *.tbz, a small enhancement... oh, and maybe
*.arj -> unarj and *.lzh,*.lha -> lha (but possibly using the following
suggested enhancement).

But a bigger enhancement would be to implement pluggable handlers into
lesspipe.sh, say if I install unrar, I'd like less to read *.rar archives.  It'd
be nice if there was let's say /etc/lesspipe.d/ for small shell scripts that one
could just drop new handlers into.  The following patch works for me, but may
need some refining.  Following the patch is a source for /etc/lesspipe.d/rar
that adds the *.rar -> unrar functionality.  Please consider implementing this!

--- lesspipe.sh~        2002-06-23 22:50:27.000000000 +0300
+++ lesspipe.sh 2003-01-13 01:24:25.000000000 +0200
@@ -22,13 +22,16 @@
        fi ;;
   *.tar) tar tvvf "$1" ;;
   *.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
-  *.tar.bz2|*.tbz2) bzip2 -dc "$1" | tar tvvf - ;;
+  *.tar.bz2|*.tbz2|*.tbz) bzip2 -dc "$1" | tar tvvf - ;;
   *.[zZ]|*.gz) gzip -dc -- "$1" ;;
   *.bz2) bzip2 -dc -- "$1" ;;
   *.zip) zipinfo -- "$1" ;;
   *.rpm) rpm -qpivl --changelog -- "$1" ;;
   *.cpi|*.cpio) cpio -itv < "$1" ;;
   esac
+  for script in /etc/lesspipe.d/*; do
+    sh "$script" "$1"
+  done
 }


----- source for /etc/lesspipe.d/rar -----

#!/bin/sh -

case "$1" in
    *.rar) unrar l -p- "$1" ;;
esac

Comment 1 Karsten Hopp 2004-11-16 15:17:32 UTC
Looks like I can't get some spare time to really implement, and more
important and time consuming, test this. Since the other packages
you've mentioned would need a similar fix to write the scripts in
/etc/lesspipe.d and I have even less time to do that, I'll opt for
DEFERRED and maybe I can pick it up again later. 


Note You need to log in before you can comment on or make changes to this bug.