From a2182822b5dd201f6fad64f0966a5e64d0ebd2a9 Mon Sep 17 00:00:00 2001 From: wf Date: Wed, 17 Aug 2022 11:56:28 +0200 Subject: [PATCH] prep for version 2.06 --- ChangeLog | 7 ++++++- README.md | 3 +-- lesspipe.sh | 10 ++++------ packaging/control | 4 +--- packaging/lesspipe.spec | 6 ++++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ee4809..91ca22e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ **************************************************************************** # ChangeLog for lesspipe.sh # **************************************************************************** -- many changes from shellcheck for better syntax +Version 2.06 Aug 17 2022 +- remove perl storable (pst) files interpretation (security fix) +- let bat recognize language, unless explicitly requested +- call the bat colorizer with style=plain +- many changes from ShellCheck for better syntax +- run ShellCheck and test suite in GitHub Actions - better recognition of hdf and matlab files Version 2.05 Apr 26 2022 - better colorize handling for bat and file names containing spaces diff --git a/README.md b/README.md index e5f4525..b914e02 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # lesspipe.sh, a preprocessor for less -Version: 2.05 +Version: 2.06 Author : Wolfgang Friebel [wp.friebel@gmail.com](mailto://wp.friebel@gmail.com) License: GPL @@ -213,7 +213,6 @@ the author by email. - html,xml requires `w3m` or `lynx` or `elinks` or `html2text` - pdf requires `pdftotext` or `pdftohtml` - perl pod requires `pod2text` or `perldoc` -- perl storable requires perl (and the modules Storable and Data::Dumper) - dvi requires `dvi2tty` - djvu requires `djvutxt` - ps requires `ps2ascii` (from the gs package) diff --git a/lesspipe.sh b/lesspipe.sh index 19104dd..c34ebc3 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# lesspipe.sh, a preprocessor for less (version 2.05) +# lesspipe.sh, a preprocessor for less (version 2.06) # Author: Wolfgang Friebel (wp.friebel AT gmail.com) #( [[ -n 1 && -n 2 ]] ) > /dev/null 2>&1 || exec zsh -y --ksh-arrays -- "$0" ${1+"$@"} @@ -402,13 +402,11 @@ has_colorizer () { for i in bat batcat pygmentize source-highlight code2color vimcolor ; do [[ -z $prog || $prog == "$i" ]] && has_cmd "$i" && prog=$i done - [[ "$2" =~ ^[0-9]*$ ]] && opt=() || opt=(-l "$2") - ext=${fileext##*.} + [[ "$2" =~ ^[0-9]*$ || -z "$2" ]] && opt=() || opt=(-l "$2") case $prog in bat|batcat) # only allow an explicitly requested language - opt=(-l "$ext") - { [[ -n $ext ]] && "$prog" "${opt[@]}" /dev/null; } || opt=() + [[ -z $3 ]] && opt=() || opt=(-l "$3") opt+=("$COLOR" --style=plain --paging=never) ;; pygmentize) pygmentize -l "$2" /dev/null &>/dev/null && opt=(-l "$2") || opt=(-g) @@ -569,7 +567,7 @@ isfinal () { [[ -z "$fext" && $fcat == text && $x != plain ]] && fext=$x [[ -z "$fext" ]] && fext=$(fileext "$fileext") fext=${fext##*/} - [[ -z ${colorizer[*]} ]] && has_colorizer "$1" "$fext" + [[ -z ${colorizer[*]} ]] && has_colorizer "$1" "$fext" "$file2" [[ -n ${colorizer[*]} && $fcat != binary ]] && "${colorizer[@]}" "$1" && return # if fileext set, we need to filter to get rid of .fileext [[ -n $fileext || "$1" == - || "$1" == "$t" ]] && cat "$1" diff --git a/packaging/control b/packaging/control index 8b55c96..46434c5 100644 --- a/packaging/control +++ b/packaging/control @@ -1,5 +1,5 @@ Package: lesspipe -Version: 2.05-1 +Version: 2.06-1 Section: text Priority: optional Architecture: all @@ -20,5 +20,3 @@ Description: lesspipe.sh is an input filter for the pager less. easily extensible for new formats. The input filter is a bash script, but works as well as a zsh script. For zsh and bash a completion mechanism for archive contents is provided. - - diff --git a/packaging/lesspipe.spec b/packaging/lesspipe.spec index 5ea700b..c3fb296 100644 --- a/packaging/lesspipe.spec +++ b/packaging/lesspipe.spec @@ -1,5 +1,5 @@ %define packagename lesspipe -%define packageversion 2.05 +%define packageversion 2.06 %define packagerelease 1 Name: %{packagename} @@ -89,7 +89,9 @@ cd $RPM_BUILD_DIR %docdir %{prefix}/share/man/man1 %changelog -* Tue Apr 26 2022 2.05-1 20220228 - wp.friebel@gmail.com +* Wed Aug 17 2022 2.06-1 20220817 - wp.friebel@gmail.com +- remove perl storable files handling, changes recommended by Shellcheck +* Tue Apr 26 2022 2.05-1 20220426 - wp.friebel@gmail.com - fix colorizing using bat and for file names containing spaces * Mon Feb 28 2022 2.04-1 20220228 - wp.friebel@gmail.com - handle csv files, lessfilter can be in path