Skip to content

Commit

Permalink
improved recognition of appimage files, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wofr06 committed Oct 13, 2024
1 parent 9c72ab0 commit 922f043
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
****************************************************************************
# ChangeLog for lesspipe.sh #
****************************************************************************
- improved recognition of appimage files
Version 2.15 Oct 03 2024
- improved parsing of bat/batcat options in LESSCOLORIZE
- display all certificates in pem files, not only the 1st one
Expand Down
19 changes: 10 additions & 9 deletions lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ filetype () {
[[ $fcat == text ]] && ftype="$fext" ;;
tsx)
[[ $fcat == text ]] && ftype=typescript-jsx ;;
appimage)
[[ $fcat == application && -x "$1" ]] && ftype="$fext" ;;
appimage|AppImage)
[[ $fcat == application && -x "$1" ]] && ftype=appimage ;;
snap)
[[ $fcat == application ]] && ftype="$fext" ;;
esac
Expand Down Expand Up @@ -295,18 +295,19 @@ get_unpack_cmd () {
[[ $2 == - ]] || fileext="$2"
fileext=${fileext%%.gz}; fileext=${fileext%%.bz2}
[[ $x == compress ]] && x=gzip
has_cmd "$x" && cmd=("$x" -cd "$2") && return ;;
has_cmd "$x" && cmd=("$x" -cd "$2") ;;
zstd)
has_cmd zstd && cmd=(zstd -cdqM1073741824 "$2") && return ;;
has_cmd zstd && cmd=(zstd -cdqM1073741824 "$2") ;;
lz4)
has_cmd lz4 && cmd=(lz4 -cdq "$2") && return ;;
has_cmd lz4 && cmd=(lz4 -cdq "$2") ;;
xlsx)
has_cmd in2csv && cmd=(in2csv -f xlsx "$2") && return
has_cmd excel2csv && cmd=(istemp excel2csv "$2") && return ;;
{ has_cmd in2csv && cmd=(in2csv -f xls "$2"); } ||

This comment has been minimized.

Copy link
@harkabeeparolus

harkabeeparolus Dec 9, 2024

There is a bug that was introduced here.

  • in2csv -f xlsx has been changed to xls instead. This fails on basically every xlsx file.
  • Testing for the command excel2csvbut running xls2csv.

Seems like a simple copy-paste error from the "ms-excel" section below.

{ has_cmd excel2csv && cmd=(istemp xls2csv "$2"); } ;;
ms-excel)
has_cmd in2csv && cmd=(in2csv -f xls "$2") && return
has_cmd xls2csv && cmd=(istemp xls2csv "$2") && return ;;
{ has_cmd in2csv && cmd=(in2csv -f xls "$2"); } ||
{ has_cmd xls2csv && cmd=(istemp xls2csv "$2"); } ;;
esac
[[ $cmd == '' ]] || return
# convert into utf8

if [[ -n $lclocale && $fchar != binary && $fchar != *ascii && $fchar != "$lclocale" && $fchar != unknown* ]]; then
Expand Down

0 comments on commit 922f043

Please sign in to comment.