"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lesspipe.sh.in" between
lesspipe-1.85.tar.gz and lesspipe-1.86.tar.gz

About: lesspipe is an input filter for the pager "less" to view files with binary content, compressed files, archives and files contained in archives.

lesspipe.sh.in  (lesspipe-1.85):lesspipe.sh.in  (lesspipe-1.86)
# lesspipe.sh, a preprocessor for less (version 1.83) # lesspipe.sh, a preprocessor for less (version 1.85)
#=============================================================================== #===============================================================================
### THIS FILE IS GENERATED FROM lesspipe.sh.in, PLEASE GET THE ZIP FILE ### THIS FILE IS GENERATED FROM lesspipe.sh.in, PLEASE GET THE ZIP FILE
### from https://github.com/wofr06/lesspipe.sh/archive/lesspipe.zip ### from https://github.com/wofr06/lesspipe.sh/archive/lesspipe.zip
### AND RUN configure TO GENERATE A lesspipe.sh THAT WORKS IN YOUR ENVIRONMENT ### AND RUN configure TO GENERATE A lesspipe.sh THAT WORKS IN YOUR ENVIRONMENT
#=============================================================================== #===============================================================================
# #
# Usage: lesspipe.sh is called when the environment variable LESSOPEN is set: # Usage: lesspipe.sh is called when the environment variable LESSOPEN is set:
# LESSOPEN="|lesspipe.sh %s"; export LESSOPEN (sh like shells) # LESSOPEN="|lesspipe.sh %s"; export LESSOPEN (sh like shells)
# setenv LESSOPEN "|lesspipe.sh %s" (csh, tcsh) # setenv LESSOPEN "|lesspipe.sh %s" (csh, tcsh)
# Use the fully qualified path if lesspipe.sh is not in the search path # Use the fully qualified path if lesspipe.sh is not in the search path
skipping to change at line 52 skipping to change at line 52
cmd_exist () { cmd_exist () {
command -v "$1" > /dev/null 2>&1 && return 0 || return 1 command -v "$1" > /dev/null 2>&1 && return 0 || return 1
} }
if [[ "$LESS_ADVANCED_PREPROCESSOR" = '' ]]; then if [[ "$LESS_ADVANCED_PREPROCESSOR" = '' ]]; then
NOL_A_P=_NO_L_A_P NOL_A_P=_NO_L_A_P
fi fi
filecmd() { filecmd() {
file -L -s "$@" file -L -s "$@"
file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr [:lower:] [:u pper:]
} }
TMPDIR=${TMPDIR:-/tmp} TMPDIR=${TMPDIR:-/tmp}
sep=: # file name separator sep=: # file name separator
altsep== # alternate separator character altsep== # alternate separator character
# if the alternate separator char is used it is repeated at the end of the line # if the separator is part of the file name then altsep is used
if [[ -e "$1" && "$1" = *$sep* || "$1" = *$altsep ]]; then if [[ -e "$1" && "$1" = *$sep* || "$1" = *$sep*$altsep* ]]; then
sep=$altsep sep=$altsep
xxx="${1%=}" xxx="${1%=}"
set "$xxx" set "$xxx"
fi fi
if cmd_exist mktemp; then tmpdir="$TMPDIR"/lesspipe."$RANDOM"
tmpdir=$(mktemp -d "$TMPDIR/lesspipe.XXXXXXXXXX") mkdir "$tmpdir"
nexttmp () { nexttmp () {
# nexttmp -d returns a directory new="$tmpdir/lesspipe.$RANDOM"
mktemp "$1" "${tmpdir}/XXXXXXXX" [[ "$1" = -d ]] && mkdir "$new"
} echo "$new"
else }
tmpdir="$TMPDIR"/lesspipe."$RANDOM"
mkdir "$tmpdir"
nexttmp () {
new="$tmpdir/lesspipe.$RANDOM"
[[ "$1" = -d ]] && mkdir "$new"
echo "$new"
}
fi
[[ -d "$tmpdir" ]] || exit 1 [[ -d "$tmpdir" ]] || exit 1
trap "rm -rf '$tmpdir'" 0 trap "rm -rf '$tmpdir'" 0
trap - PIPE trap - PIPE
unset iconv unset iconv
iconv() { iconv() {
if [[ -z "$iconv" ]]; then if [[ -z "$iconv" ]]; then
arg=$(printf "%s$(command iconv --help 2>/dev/null | \ arg=$(printf "%s$(command iconv --help 2>/dev/null | \
sed -n 's/.*\(--.*-subst=\)\(FORMATSTRING\).*/\1\\033[7m?\\033[m/p' | \ sed -n 's/.*\(--.*-subst=\)\(FORMATSTRING\).*/\1\\033[7m?\\033[m/p' | \
tr \\n ' ')") tr \\n ' ')")
skipping to change at line 117 skipping to change at line 108
echo "==> $@" echo "==> $@"
} }
filetype () { filetype () {
# wrapper for 'file' command # wrapper for 'file' command
typeset name typeset name
name="$1" name="$1"
if [[ "$1" = - ]]; then if [[ "$1" = - ]]; then
name="$filen" name="$filen"
fi fi
#ifdef brotli # ifdef brotli
if [[ ("$name" = *.br || "$name" = *.bro || "$name" = *.tbr) ]]; then if [[ ("$name" = *.br || "$name" = *.bro || "$name" = *.tbr) ]]; then
# In current format, brotli can only be detected by extension # In current format, brotli can only be detected by extension
echo " brotli compressed data" echo " brotli compressed data"
return return
fi fi
#endif # endif
if [[ "$1" = - ]]; then if [[ "$1" = - ]]; then
dd bs=40000 count=1 > "$tmpdir/file" 2>/dev/null dd bs=40000 count=1 > "$tmpdir/file" 2>/dev/null
set "$tmpdir/file" "$2" set "$tmpdir/file" "$2"
fi fi
typeset return typeset return
# file -b not supported by all versions of 'file' # file -b not supported by all versions of 'file'
type="$(filecmd "$1" | cut -d : -f 2- )" type="$(filecmd "$1" | cut -d : -f 2- )"
if [[ "$type" = " empty" ]]; then if [[ "$type" = " empty" ]]; then
# exit if file returns "empty" (e.g., with "less archive:nonexisting_file") # exit if file returns "empty" (e.g., with "less archive:nonexisting_file")
exit 1 exit 1
# Open Office # Open Office
elif [[ "$type" = *OpenDocument\ Text* ]]; then elif [[ "$type" = *OpenDocument\ Text* ]]; then
return=" OpenDocument Text" return=" OpenDocument Text"
elif [[ "$type" = *OpenDocument\ * || "$type" = *OpenOffice\.org\ 1\.x\ * ]]; then elif [[ "$type" = *OpenDocument\ * || "$type" = *OpenOffice\.org\ 1\.x\ * ]]; then
return=" OpenDocument" return=" OpenDocument"
# Microsoft Office < 2007 # Microsoft Office < 2007
elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.do[st]) ]] || elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.do[st]) ]] ||
[[ "$type" = *Microsoft\ Office\ Word* ]]; then [[ "$type" = *Microsoft\ Office\ Word* ]]; then
return=" Microsoft Word Document" return=" Microsoft Word Document"
elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.pp[st]) ]] || elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.pp[st]) ]] ||
[[ "$type" = *Microsoft\ Office\ PowerPoint* ]]; then [[ "$type" = *Microsoft\ Office\ PowerPoint* ]]; then
return=" Microsoft PowerPoint Document" return=" Microsoft PowerPoint Document"
elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.xl[mst]) ]] || elif [[ "$type" = *Microsoft\ Office\ Document* && ("$name" = *.xl[mst]) ]] ||
[[ "$type" = *Microsoft\ Excel* ]]; then [[ "$type" = *Microsoft\ Excel* ]]; then
return=" Microsoft Excel Document" return=" Microsoft Excel Document"
elif [[ "$type" = *Microsoft\ Office\ Document* ]]; then elif [[ "$type" = *Microsoft\ Office\ Document* || "$type" = *Composite\ Documen
return=" Microsoft Office Document" t\ File\ V2* ]]; then
# Microsoft Office >= 2007 return=" Microsoft Office Document"
elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = # Microsoft Office >= 2007
*.do[ct][xm] ]] || elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = *
[[ "$type" = *Microsoft\ Word\ 2007* ]]; then .do[ct][xm] ]] ||
return=" Microsoft Word 2007+" [[ "$type" = *Microsoft\ Word\ 2007* ]]; then
return=" Microsoft Word 2007+"
elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = *.pp[st][xm] ]] || elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = *.pp[st][xm] ]] ||
[[ "$type" = *Microsoft\ PowerPoint\ 2007* ]]; then [[ "$type" = *Microsoft\ PowerPoint\ 2007* ]]; then
return=" Microsoft PowerPoint 2007+" return=" Microsoft PowerPoint 2007+"
elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = elif [[ ("$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML) && "$name" = *
*.xl[st][xmb] ]] || .xl[st][xmb] ]] ||
[[ "$type" = *Microsoft\ Excel\ 2007* ]]; then [[ "$type" = *Microsoft\ Excel\ 2007* ]]; then
return=" Microsoft Excel 2007+" return=" Microsoft Excel 2007+"
elif [[ "$type" = *Zip\ archive* || "$type" = Microsoft\ OOXML ]] || elif [[ "$type" = Microsoft\ OOXML ]] ||
[[ "$type" = *Microsoft\ *\ 2007* ]]; then [[ "$type" = *Microsoft\ *\ 2007* ]]; then
return=" Microsoft Office 2007" return=" Microsoft Office 2007"
# MP3 # MP3
elif [[ "$type" = *MPEG\ *layer\ 3\ audio* || "$type" = *MPEG\ *layer\ III* || elif [[ "$type" = *MPEG\ *layer\ 3\ audio* || "$type" = *MPEG\ *layer\ III* || "
"$type" = *mp3\ file* || "$type" = *MP3* ]]; then $type" = *mp3\ file* || "$type" = *MP3* ]]; then
return="mp3" return="mp3"
# Compressed Archives # Compressed Archives
elif [[ "$type" != *lzip\ compressed* && ("$name" = *.lzma || "$name" = *.tlz) elif [[ "$type" != *lzip\ compressed* && ("$name" = *.lzma || "$name" = *.tlz) ]
]]; then ]; then
return=" LZMA compressed data" return=" LZMA compressed data"
elif [[ ("$type" = *Zip* || "$type" = *ZIP*) && ("$name" = *.jar || "$name" = elif [[ ("$type" = *Zip* || "$type" = *ZIP* || "$type" = *JAR*) && ("$name" = *.
*.xpi) ]]; then jar || "$name" = *.xpi) ]]; then
return=" Zip compressed Jar archive" return=" Zip compressed Jar archive"
elif [[ "$type" = *Hierarchical\ Data\ Format* && ("$name" = *.nc4) ]]; then elif [[ "$type" = *Hierarchical\ Data\ Format* && ("$name" = *.nc4) ]]; then
return=" NetCDF Data Format data" return=" NetCDF Data Format data"
# Sometimes a BSD makefile is identified as "troff or preprocessor input # Sometimes a BSD makefile is identified as "troff or preprocessor input
# text" probably due to its ".if" style directives. # text" probably due to its ".if" style directives.
elif [[ "$type" = *roff\ *,* && ("$name" = */[Mm]akefile || "$name" = */[Mm]ak elif [[ "$type" = *roff\ *,* && ("$name" = */[Mm]akefile || "$name" = */[Mm]akef
efile.* || "$name" = */BSDmakefile || "$name" = *.mk) ]]; then ile.* || "$name" = */BSDmakefile || "$name" = *.mk) ]]; then
return=" BSD makefile script,${type#*,}}" return=" BSD makefile script,${type#*,}}"
# Correct HTML Detection # Correct HTML Detection
elif [[ ("$type" = *HTML* || "$type" = *ASCII*) && "$name" = *xml ]]; then elif [[ ("$type" = *HTML* || "$type" = *ASCII*) && "$name" = *xml ]]; then
return=" XML document text" return=" XML document text"
elif [[ "$type" = *XML* && "$name" = *html ]]; then elif [[ "$type" = *XML* && "$name" = *html ]]; then
return=" HTML document text" return=" HTML document text"
fi fi
if [[ -n "$return" ]]; then if [[ -n "$return" ]]; then
echo "$return" echo "$return"
return return
elif [[ -n "$type" ]]; then fi
echo "$type"
return
fi
# file -b not supported by all versions of 'file' # file -b not supported by all versions of 'file'
mime="$(file -i "$1" | cut -d : -f 2-)" mime="$(file -i "$1" | cut -d : -f 2-)"
if [[ "$mime" = \ text/* ]]; then if [[ "$mime" = \ text/* ]]; then
return="text" return="text"
elif [[ "$mime" = \ image/* ]]; then elif [[ "$mime" = \ image/* ]]; then
return="image" return="image"
elif [[ "$mime" = \ audio/* ]]; then elif [[ "$mime" = \ audio/* ]]; then
return="audio" return="audio"
elif [[ "$mime" = \ video/* ]]; then elif [[ "$mime" = \ video/* ]]; then
return="video" return="video"
fi fi
if [[ -n "$return" ]]; then if [[ -n "$return" ]]; then
echo "$return" echo "$return"
return return
fi fi
if [[ -n "$mime" ]]; then if [[ -n "$mime" ]]; then
return="$mime" return="$mime"
else else
return="" return=""
fi fi
echo "$return" echo "$return"
} }
show () { show () {
file1="${1%%$sep*}" file1="${1%%$sep*}"
rest1="${1#$file1}" rest1="${1#$file1}"
while [[ "$rest1" = ::* ]]; do while [[ "$rest1" = ::* ]]; do
if [[ "$rest1" = "::" ]]; then if [[ "$rest1" = "::" ]]; then
break break
else else
rest1="${rest1#$sep$sep}" rest1="${rest1#$sep$sep}"
skipping to change at line 662 skipping to change at line 650
cmd_string="zstd -dcqM1073741824 -" cmd_string="zstd -dcqM1073741824 -"
elif [[ ("$1" == *br || "$1" == *bro) ]]; then elif [[ ("$1" == *br || "$1" == *bro) ]]; then
cmd_string="brotli -dc -" cmd_string="brotli -dc -"
elif [[ "$1" == *lz4 ]]; then elif [[ "$1" == *lz4 ]]; then
cmd_string="lz4 -dcq -" cmd_string="lz4 -dcq -"
fi fi
echo "$cmd_string" echo "$cmd_string"
} }
isfinal() { isfinal() {
# color requires -r or -R when calling less
typeset COLOR
if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then
COLOR="--color=always"
else
COLOR="--color=auto"
fi
typeset t typeset t
if [[ $3 = $sep$sep ]]; then if [[ $3 = $sep$sep ]]; then
cat "$2" cat "$2"
return return
elif [[ $3 = $sep* ]]; then elif [[ $3 = $sep* ]]; then
# the next conditional is only there to conditionally remove syntax highlighting code # the next conditional is only there to conditionally remove syntax highlighting code
#ifdef perl #ifdef perl
if [[ $3 = "$sep" ]]; then if [[ $3 = "$sep" ]]; then
msg "append :. or :<filetype> to activate syntax highlighting" msg "append :. or :<filetype> to activate syntax highlighting"
else else
lang=${3#$sep} lang=${3#$sep}
lang="-l${lang#.}" lang="-l${lang#.}"
lang=${lang%%-l } lang=${lang%%-l }
if cmd_exist code2color; then if cmd_exist bat; then
code2color $PPID ${in_file:+"$in_file"} "$lang" "$2" if [[ "$lang" = "-l" ]]; then
if [[ $? = 0 ]]; then bat $COLOR "$2"
return else
bat $COLOR "$lang" "$2"
fi
[[ $? = 0 ]] && return
elif cmd_exist batcat; then
if [[ "$lang" = "-l" ]]; then
batcat $COLOR "$2"
else
batcat $COLOR "$lang" "$2"
fi fi
[[ $? = 0 ]] && return
elif cmd_exist code2color; then
code2color $PPID ${in_file:+"$in_file"} "$lang" "$2"
[[ $? = 0 ]] && return
fi fi
fi fi
#endif #endif
cat "$2" cat "$2"
return return
fi fi
lang="$(echo $LANG | tr '[:upper:]' '[:lower:]')" lang="$(echo $LANG | tr '[:upper:]' '[:lower:]')"
# color requires -r or -R when calling less
typeset COLOR
if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then
COLOR="--color=always"
fi
if [[ "$1" = *No\ such* ]]; then if [[ "$1" = *No\ such* ]]; then
exit 1 exit 1
elif [[ "$1" = *directory* ]]; then elif [[ "$1" = *directory* ]]; then
set -A cmd ls -lA $COLOR "$2" set -A cmd ls -lA $COLOR "$2"
if ! ls $COLOR > /dev/null 2>&1; then if ! ls $COLOR > /dev/null 2>&1; then
set -A cmd ls -lA -G "$2" set -A cmd ls -lA -G "$2"
if ! ls -lA -G > /dev/null 2>&1; then if ! ls -lA -G > /dev/null 2>&1; then
set -A cmd ls -lA "$2" set -A cmd ls -lA "$2"
fi fi
skipping to change at line 810 skipping to change at line 812
# do not display all perl text containing pod using perldoc # do not display all perl text containing pod using perldoc
#elif [[ "$1" = *Perl\ POD\ document\ text* || "$1" = *Perl5\ module\ source\ text* ]]; then #elif [[ "$1" = *Perl\ POD\ document\ text* || "$1" = *Perl5\ module\ source\ text* ]]; then
elif [[ "$1" = *Perl\ POD\ document\ text$NOL_A_P* ]] && cmd_exist perldoc; th en elif [[ "$1" = *Perl\ POD\ document\ text$NOL_A_P* ]] && cmd_exist perldoc; th en
msg "append $sep to filename to view the perl source" msg "append $sep to filename to view the perl source"
istemp perldoc "$2" istemp perldoc "$2"
#endif #endif
elif [[ "$1" = *\ script* ]]; then elif [[ "$1" = *\ script* ]]; then
set "plain text" "$2" set "plain text" "$2"
elif [[ "$1" = *text\ executable* ]]; then elif [[ "$1" = *text\ executable* ]]; then
set "plain text" "$2" set "plain text" "$2"
#ifdef pstotext
elif [[ "$1" = *PostScript$NOL_A_P* ]]; then elif [[ "$1" = *PostScript$NOL_A_P* ]]; then
if cmd_exist pstotext; then #ifdef ps2ascii
msg "append $sep to filename to view the postscript file" if cmd_exist ps2ascii; then
nodash pstotext "$2"
elif cmd_exist ps2ascii; then
msg "append $sep to filename to view the postscript file" msg "append $sep to filename to view the postscript file"
istemp ps2ascii "$2" nodash ps2ascii "$2"
else
msg "install pstotext or ps2ascii to view a textual representation of the
file contents"
fi fi
#elif ps2ascii #elif pstotext
elif [[ "$1" = *PostScript$NOL_A_P* ]]; then if cmd_exist pstotext; then
if cmd_exist ps2ascii; then
msg "append $sep to filename to view the postscript file" msg "append $sep to filename to view the postscript file"
istemp ps2ascii "$2" istemp pstotext "$2"
else
msg "install pstotext or ps2ascii to view a textual representation of the
file contents"
fi fi
#else
msg "install pstotext or ps2ascii to view a textual representation of the fi
le contents"
#endif #endif
elif [[ "$1" = *executable* ]]; then elif [[ "$1" = *executable* ]]; then
msg "append $sep to filename to view the raw file" msg "append $sep to filename to view the raw file"
nodash strings "$2" nodash strings "$2"
elif [[ "$1" = *\ ar\ archive* ]]; then elif [[ "$1" = *\ ar\ archive* ]]; then
msg "use library${sep}contained_file to view a file in the archive" msg "use library${sep}contained_file to view a file in the archive"
istemp "ar vt" "$2" istemp "ar vt" "$2"
#ifdef nm #ifdef nm
elif [[ "$1" = *shared* ]] && cmd_exist nm; then elif [[ "$1" = *shared* ]] && cmd_exist nm; then
msg "This is a dynamic library, showing the output of nm" msg "This is a dynamic library, showing the output of nm"
skipping to change at line 946 skipping to change at line 942
#endif #endif
#ifdef dvi2tty #ifdef dvi2tty
elif [[ "$1" = *\ DVI* ]] && cmd_exist dvi2tty; then elif [[ "$1" = *\ DVI* ]] && cmd_exist dvi2tty; then
msg "append $sep to filename to view the raw DVI file" msg "append $sep to filename to view the raw DVI file"
isdvi "$2" isdvi "$2"
#endif #endif
elif [[ "$PARSEHTML" = yes && "$1" = *HTML$NOL_A_P* ]]; then elif [[ "$PARSEHTML" = yes && "$1" = *HTML$NOL_A_P* ]]; then
msg "append $sep to filename to view the HTML source" msg "append $sep to filename to view the HTML source"
parsehtml "$2" parsehtml "$2"
#ifdef pdftotext #ifdef pdftotext
elif [[ "$1" = *PDF* ]] && cmd_exist pdftotext; then elif [[ "$1" = *pdf* ]] && cmd_exist pdftotext; then
if [[ "$PARSEHTML" = yes ]]; then if [[ "$PARSEHTML" = yes ]]; then
msg "append $sep to filename to view the PDF source" msg "append $sep to filename to view the PDF source"
istemp "pdftotext -htmlmeta" "$2" - | parsehtml - istemp "pdftotext -htmlmeta -nopgbrk -q --" "$2" - | parsehtml -
else else
msg "append $sep to filename to view the PDF source" msg "append $sep to filename to view the PDF source"
istemp pdftotext "$2" - istemp pdftotext -nopgbrk -q -- "$2" -
fi fi
#endif #endif
#ifdef pdftohtml #ifdef pdftohtml
elif [[ "$PARSEHTML" = yes && "$1" = *PDF* ]] && cmd_exist pdftohtml; then elif [[ "$PARSEHTML" = yes && "$1" = *pdf* ]] && cmd_exist pdftohtml; then
msg "append $sep to filename to view the PDF source" msg "append $sep to filename to view the PDF source"
t=$(nexttmp) t=$(nexttmp)
cat "$2" > "$t"; pdftohtml -stdout "$t" | parsehtml - cat "$2" > "$t"; pdftohtml -i -noframes -nodrm -enc UTF-8 -stdout "$t" | par sehtml -
#endif #endif
#ifdef pdfinfo #ifdef pdfinfo
elif [[ "$1" = *PDF* ]] && cmd_exist pdfinfo; then elif [[ "$1" = *pdf* ]] && cmd_exist pdfinfo; then
msg "append $sep to filename to view the PDF source" msg "append $sep to filename to view the PDF source"
istemp pdfinfo "$2" istemp pdfinfo "$2"
#ifdef h5dump #ifdef h5dump
elif [[ "$1" = *Hierarchical\ Data\ Format* ]] && cmd_exist h5dump; then elif [[ "$1" = *Hierarchical\ Data\ Format* ]] && cmd_exist h5dump; then
istemp h5dump "$2" istemp h5dump "$2"
#endif #endif
#ifdef ncdump #ifdef ncdump
elif [[ "$1" = *NetCDF* || "$1" = *Hierarchical\ Data\ Format* ]] && cmd_exist ncdump; then elif [[ "$1" = *NetCDF* || "$1" = *Hierarchical\ Data\ Format* ]] && cmd_exist ncdump; then
istemp ncdump "$2" istemp ncdump "$2"
#endif #endif
skipping to change at line 997 skipping to change at line 993
docx2txt.pl "$2" - docx2txt.pl "$2" -
else else
msg "install docx2txt.pl to view human readable text" msg "install docx2txt.pl to view human readable text"
cat "$2" cat "$2"
fi fi
#elif doc2txt.pl #elif doc2txt.pl
#ifdef odt2txt #ifdef odt2txt
elif [[ "$1" = *OpenDocument\ Text* ]]; then elif [[ "$1" = *OpenDocument\ Text* ]]; then
if cmd_exist odt2txt; then if cmd_exist odt2txt; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
odt2txt "$2" istemp odt2txt "$2"
else else
msg "install odt2txt to view human readable text" msg "install odt2txt to view human readable text"
cat "$2" cat "$2"
fi fi
#elif odt2txt #elif odt2txt
#ifdef pandoc #ifdef pandoc
elif [[ "$1" = *Microsoft\ Word\ 2007* ]]; then elif [[ "$1" = *Microsoft\ Word\ 2007* ]]; then
if cmd_exist pandoc; then if cmd_exist pandoc; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
pandoc --from=docx --to=plain "$2" pandoc --from=docx --to=plain "$2"
skipping to change at line 1030 skipping to change at line 1026
elif [[ "$1" = *EPUB\ document* ]]; then elif [[ "$1" = *EPUB\ document* ]]; then
if cmd_exist pandoc; then if cmd_exist pandoc; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
pandoc --from=epub --to=plain "$2" pandoc --from=epub --to=plain "$2"
else else
msg "install pandoc to view human readable text" msg "install pandoc to view human readable text"
cat "$2" cat "$2"
fi fi
#elif pandoc #elif pandoc
#ifdef wvText #ifdef wvText
elif [[ "$1" = *Microsoft\ Word\ Document* ]] && cmd_exist wvText; then elif [[ "$1" = *Microsoft\ Word\ Document* || "$1" = *Microsoft\ Office\ Docum ent* ]] && cmd_exist wvText; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
wvText "$2" /dev/stdout wvText "$2" /dev/stdout
#ifdef antiword #ifdef antiword
elif [[ "$1" = *Microsoft\ Word\ Document* ]]; then elif [[ "$1" = *Microsoft\ Word\ Document* || "$1" = *Microsoft\ Office\ Docum ent* ]]; then
if cmd_exist antiword; then if cmd_exist antiword; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
antiword "$2" antiword "$2"
elif cmd_exist catdoc; then elif cmd_exist catdoc; then
msg "append $sep to filename to view the raw word document" msg "append $sep to filename to view the raw word document"
catdoc "$2" catdoc "$2"
else else
msg "install antiword or catdoc to view human readable text" msg "install antiword or catdoc to view human readable text"
cat "$2" cat "$2"
fi fi
skipping to change at line 1160 skipping to change at line 1156
joliet=$(isoinfo -d -i "$2" | grep -E '^Joliet'|cut -c1) joliet=$(isoinfo -d -i "$2" | grep -E '^Joliet'|cut -c1)
echo "================================= Content ========================== ============" echo "================================= Content ========================== ============"
isoinfo -lR"$joliet" -i "$2" isoinfo -lR"$joliet" -i "$2"
fi fi
#endif #endif
#ifdef lsbom #ifdef lsbom
elif [[ "$1" = *bill\ of\ materials* ]] && cmd_exist lsbom; then elif [[ "$1" = *bill\ of\ materials* ]] && cmd_exist lsbom; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
lsbom -p MUGsf "$2" lsbom -p MUGsf "$2"
#endif #endif
elif [[ "$1" = *perl\ Storable$NOL_A_P* ]]; then elif [[ "$1" = *perl.?[sS]torable$NOL_A_P* ]]; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
perl -MStorable=retrieve -MData::Dumper -e '$Data::Dumper::Indent=1;print Du mper retrieve shift' "$2" perl -MStorable=retrieve -MData::Dumper -e '$Data::Dumper::Indent=1;print Du mper retrieve shift' "$2"
#ifdef iconv #ifdef iconv
elif [[ "$1" = *UTF-8$NOL_A_P* && "$lang" != *utf-8* ]] && cmd_exist iconv -c; elif [[ "$1" = *UTF-8$NOL_A_P* && "$lang" != *utf-8* ]] && cmd_exist iconv; th
then en
iconv -c -f UTF-8 "$2" iconv -f UTF-8 "$2"
elif [[ "$1" = *UTF-16$NOL_A_P* && "$lang" != *utf-16* ]] && cmd_exist iconv - elif [[ "$1" = *UTF-16$NOL_A_P* && "$lang" != *utf-16* ]] && cmd_exist iconv;
c; then then
iconv -c -f UTF-16 "$2" iconv -f UTF-16 "$2"
elif [[ "$1" = *ISO-8859$NOL_A_P* && "$lang" != *iso-8859-1* ]] && cmd_exist i elif [[ "$1" = *ISO-8859$NOL_A_P* && "$lang" != *iso-8859-1* ]] && cmd_exist i
conv -c; then conv; then
iconv -c -f ISO-8859-1 "$2" iconv -f ISO-8859-1 "$2"
#endif #endif
#ifdef gpg #ifdef gpg
elif [[ "$1" = *GPG\ encrypted\ data* || "$1" = *PGP\ *ncrypted* ]] && cmd_exi st gpg; then elif [[ "$1" = *GPG\ encrypted\ data* || "$1" = *PGP\ *ncrypted* ]] && cmd_exi st gpg; then
msg "append $sep to filename to view the encrypted file" msg "append $sep to filename to view the encrypted file"
gpg -d "$2" gpg -d "$2"
#endif #endif
#ifdef plutil #ifdef plutil
elif [[ "$1" = *Apple\ binary\ property\ list* ]] && cmd_exist plutil; then elif [[ "$1" = *Apple\ binary\ property\ list* ]] && cmd_exist plutil; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
plutil -convert xml1 -o - "$2" plutil -convert xml1 -o - "$2"
skipping to change at line 1201 skipping to change at line 1197
elif [[ "$2" = *.crl ]] && cmd_exist openssl; then elif [[ "$2" = *.crl ]] && cmd_exist openssl; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
openssl crl -hash -text -noout -in "$2" openssl crl -hash -text -noout -in "$2"
#endif #endif
#ifdef identify #ifdef identify
elif [[ "$1" = "image" ]] && cmd_exist identify; then elif [[ "$1" = "image" ]] && cmd_exist identify; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
identify -verbose "$2" identify -verbose "$2"
#endif #endif
#ifdef id3v2 #ifdef id3v2
elif [[ "$1" = "mp3" ]]; then elif [[ "$1" = "mp3" ]]; then
if cmd_exist id3v2; then if cmd_exist id3v2; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
istemp "id3v2 --list" "$2" istemp "id3v2 --list" "$2"
elif cmd_exist mp3info2; then elif cmd_exist mp3info2; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
mp3info2 "$2" mp3info2 "$2"
elif cmd_exist mp3info; then elif cmd_exist mp3info; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
mp3info "$2" mp3info "$2"
fi fi
skipping to change at line 1230 skipping to change at line 1226
#endif #endif
#ifdef mediainfo #ifdef mediainfo
elif [[ "$1" = "image" || "$1" = "mp3" || "$1" = "audio" || "$1" = "video" ]] && cmd_exist mediainfo; then elif [[ "$1" = "image" || "$1" = "mp3" || "$1" = "audio" || "$1" = "video" ]] && cmd_exist mediainfo; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
mediainfo --Full "$2" mediainfo --Full "$2"
#ifdef exiftool #ifdef exiftool
elif [[ "$1" = "image" || "$1" = "mp3" || "$1" = "audio" || "$1" = "video" ]] && cmd_exist exiftool; then elif [[ "$1" = "image" || "$1" = "mp3" || "$1" = "audio" || "$1" = "video" ]] && cmd_exist exiftool; then
msg "append $sep to filename to view the raw data" msg "append $sep to filename to view the raw data"
exiftool "$2" exiftool "$2"
#endif #endif
elif [[ "$1" = *text* ]]; then fi
if [[ "$2" = *.md || "$2" = *.MD || "$2" = *.mkd || "$2" = *.markdown ]] &&
cmd_exist mdcat; then if [[ "$1" = *text* ]]; then
mdcat "$2" if [[ "$2" != '-' ]]; then
elif [[ "$2" = *.log ]] && if [[ "$1" = *ASCII\ text* || "$1" = *Unicode\ text* ]]; then
cmd_exist ccze; then cat "$2"
cat "$2" | ccze -A elif [[ "$2" = *.md || "$2" = *.MD || "$2" = *.mkd || "$2" = *.markdown ]]
&&
cmd_exist mdcat; then
mdcat "$2"
elif [[ "$2" = *.log ]] &&
cmd_exist ccze; then
cat "$2" | ccze -A
# ifdef perl
elif cmd_exist code2color; then
code2color $PPID ${in_file:+"$in_file"} "$2"
#endif
elif cmd_exist bat; then
bat $COLOR "$2"
elif cmd_exist batcat; then
batcat $COLOR "$2"
else
cat "$2"
fi
else else
cat "$2" # if [[ "$2" = - ]]; then
fi if [[ "$1" = *ASCII\ text* || "$1" = *Unicode\ text* ]]; then
else cat
if [[ "$2" = - ]]; then # ifdef perl
cat elif cmd_exist code2color; then
# ifdef perl code2color $PPID ${in_file:+"$in_file"} "$2"
else cmd_exist code2color && #endif
code2color $PPID ${in_file:+"$in_file"} "$2" && elif cmd_exist bat; then
return bat $COLOR "$2"
#endif elif cmd_exist batcat; then
fi batcat $COLOR "$2"
else
cat
fi
[[ $? = 0 ]] && return
fi
fi fi
} }
# calling show with arg1 arg2 ... is equivalent to calling with arg1:arg2:... # calling show with arg1 arg2 ... is equivalent to calling with arg1:arg2:...
IFS=$sep a="$@" IFS=$sep a="$@"
IFS=' ' IFS=' '
if [[ "$a" = "" ]]; then if [[ "$a" = "" ]]; then
if [[ "$0" != /* ]]; then if [[ "$0" != /* ]]; then
pat=$(pwd)/ pat=$(pwd)/
fi fi
 End of changes. 41 change blocks. 
163 lines changed or deleted 181 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)