Summary: | sys-apps/less: add user-override var to lesspipe.sh | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | d_m |
Component: | New packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Patch to use $LESSIGNORE |
Description
d_m
2008-04-16 13:56:21 UTC
Created attachment 149940 [details, diff] Patch to use $LESSIGNORE This is the patch that I posted in this forum thread: http://forums.gentoo.org/viewtopic-t-688322-highlight-.html two lines which execute external programs ;). it also doesnt seem to handle multi-dotted things such as ".tar.gz" perhaps this: for ignore in ${LESSIGNORE//:/ } ; do [[ ${match} == *.${ignore} ]] && exit 0 done another alternative: add a ~/.lessfilter that does: #!/bin/sh echo "$1" | grep '\.html$' && exit 1 exit 0 Haha, thanks for giving me a bash-only version. I'm not as familiar with the various splitting/matching features in bash, so I figured I'd write something that works. Your first suggestion seems the best to me. Do you think it's possible to get that merged? i'll merge it as soon as you test it and say it works for you Ok, yeah it seems great. With the environment variable unset, things work as normal. With it set, I am able to turn off highlighting for particular extensions. Interestingly, it doesn't seem to have to be colon-seperated. For instance, the following two invocations seem to work equally well: LESSIGNORE="mp3 html" less foo.mp3 LESSIGNORE="mp3:html" less foo.mp3 Also, compound extensions (e.g. tar.gz or 1.bz2) seem to work. It looks good. Thanks for helping me with this! thanks for testing ... ive added the code in question (minus the colon filter, so now it's just a space delimited list) http://sources.gentoo.org/sys-apps/less/files/lesspipe.sh?r1=1.28&r2=1.29 |