diff --git a/README.md b/README.md index e4bc0f9..d4330fc 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ the author by email. ### 4.2 List of preprocessed file types - directory displayed using `ls -lA` -- nroff(man) requires `groff` or `mandoc` +- nroff(man) requires `mandoc` or `man` or `groff` - shared library requires `nm` - MS Word (doc) requires `wvText` or `catdoc` or `libreoffice` - Powerpoint (ppt) requires `catppt` diff --git a/lesspipe.1 b/lesspipe.1 index 45f43be..2178f2b 100644 --- a/lesspipe.1 +++ b/lesspipe.1 @@ -136,9 +136,9 @@ A single colon (disengage filter) or :extension (force language) is possible as When the conditions for syntax highlighting are met directory listings and listings of tar file contents get colorized as well. .PP -As \fBless\fP is used as a default browser in other programs the choice of the -colorizer can affect the output of those programs. -For \fIman\fP, \fIgit\fP, and \fIperldoc\fP) lesspipe.sh does no filtering. +As \fBless\fP is used as a default browser in other programs (e.g. \fIman\fP, +\fIgit\fP, and \fIperldoc\fP)) \fBlesspipe.sh\fP may be engaged and alter +the output of those programs. .SH WATCHING GROWING FILES As soon as \fBlesspipe.sh\fP calls a program to convert the input the ability to watch growing files diff --git a/lesspipe.sh b/lesspipe.sh index a279cff..1d3e59c 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -398,13 +398,7 @@ analyze_args () { cmdtree=$(ps -T -oargs= 2>/dev/null) while read -r line; do arg1=${line%% *}; arg1=${arg1##*/} - case $arg1 in - man|git|perldoc) - # if lesspipe is called in pipes, return immediately for some use cases - exit 0 ;; - less) - lessarg=$line ;; - esac + [[ $arg1 == less ]] && lessarg=$line done <<< "$cmdtree" # return if we want to watch growing files [[ $lessarg == *less\ *\ +F\ * || $lessarg == *less\ *\ : ]] && exit 0 @@ -568,9 +562,9 @@ isfinal () { declare macro=andoc [[ "$fext" == me ]] && macro=e [[ "$fext" == ms ]] && macro=s - { has_cmd groff && cmd=(groff -s -p -t -e -Tutf8 -m "$macro" "$1"); } || { has_cmd mandoc && cmd=(nodash mandoc "$1"); } || - { has_cmd man && cmd=(nodash man "$1"); } ;; + { has_cmd man && cmd=(man -l "$1"); } || + { [[ $COLOR == *always ]] && has_cmd groff && cmd=(groff -s -p -t -e -Tutf8 -m "$macro" "$1"); } ;; rtf) { has_cmd unrtf && cmd=(istemp "unrtf --text" "$1"); } || { has_cmd libreoffice && cmd=(isoffice2 "$1"); } ;; @@ -581,7 +575,7 @@ isfinal () { pod) [[ -z $file2 ]] && { { has_cmd pod2text && cmd=(pod2text "$1"); } || - { has_cmd perldoc && cmd=(istemp perldoc "$1"); }; } ;; + { has_cmd perldoc && cmd=(istemp "perldoc -T" "$1"); }; } ;; hdf|hdf5) { has_cmd h5dump && cmd=(istemp h5dump "$1"); } || { has_cmd ncdump && cmd=(istemp ncdump "$1"); } ;;