Lesspipe.sh
[lesspipe] is a input filter for the less pager. Recently I asked the author about supporting wget and he provided me this patch (which I slightly modified) to 1.6.0:
--- lesspipe.sh.in 2008-12-02 06:51:49.000000000 +1100 +++ ../lesspipe.sh.in 2008-12-24 09:50:51.954197800 +1100 @@ -81,6 +81,12 @@ if [[ "$type" = " empty" ]]; then # exit if file returns "empty" (e.g., with "less archive:nonexisting_file") exit 1 + elif [[ "$type" = *cannot\ open* ]]; then + if [[ "$1" = "http" || "$1" = "https*" ]]; then + type=" URL" + else + exit 1 + fi elif [[ "$type" = *XML* && "$name" = *html ]]; then type=" HTML document text" elif [[ "$type" != *lzip*compress* && ("$name" = *.lzma || "$name" = *.tlz) ]]; then @@ -291,6 +297,10 @@ elif [[ "$1" = *ISO\ 9660* ]]; then set -A cmd isoinfo "-i$2" "-x$file2" #endif +#ifdef wget + elif [[ "$1" = *URL ]]; then + set -A cmd istemp wget "-O-" "${file1}:${file2}${rest1}" +#endif fi if [[ "$cmd" != "" ]]; then filen="$file2"
This allows one to use less to view http resources.
lesspipe is licensed under the GPL.