From 35ffb999f1cc703d1c26b1c307dcc500a7496d23 Mon Sep 17 00:00:00 2001 From: wf Date: Wed, 17 Jan 2024 23:00:25 +0100 Subject: [PATCH] reintroduce csvlook and new program csvtable for csv files --- ChangeLog | 2 ++ INSTALL | 3 +++ README.md | 3 ++- lesspipe.sh | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e5e37c3..9d6e506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ **************************************************************************** # ChangeLog for lesspipe.sh # **************************************************************************** +- use again csvlook for display of csv files if available +- use csvtable for tabular display of csv files, needs Text::CSV from perl Version 2.11 Dec 13 2023 - fix output of archive listings when no coloring is requested - column does not accept std input diff --git a/INSTALL b/INSTALL index 2b58df9..8cd30a4 100644 --- a/INSTALL +++ b/INSTALL @@ -5,12 +5,15 @@ Execute the following commands (for a more detailed description see below): ./configure # required cp lesspipe.sh /usr/local/bin + # optional for colorizing and old openoffice writer formats cp code2color archive_color vimcolor sxw2txt lesscomplete /usr/local/bin + # optional for zsh and bash completion (archive contents) cp lesscomplete /usr/local/bin # (zsh and bash) cp _less /usr/share/zsh/site-functions #(zsh) cp less_completion /etc/bashcompletion.d #(bash) + or if you prefer make: make diff --git a/README.md b/README.md index d3bc9cd..f656306 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ the author by email. - MS Word (docx) requires `pandoc` or `docx2txt` or `libreoffice` - Powerpoint (pptx) requires `pptx2md` or `libreoffice` - Excel (xlsx) requires `in2csv` or `xlscat` or `excel2csv` or `libreoffice` -- csv requires `column` or `pandoc` +- csv requires `csvtable` or `csvlook` or `column` or `pandoc` - rtf requires `unrtf` or `libreoffice` - epub requires `pandoc` - html,xml requires `w3m` or `lynx` or `elinks` or `html2text` @@ -404,6 +404,7 @@ filtering for certain file types. - cabextract https://www.cabextract.org.uk/ (2019) - catdoc,catppt,xls2csv https://www.wagner.pp.ru/~vitus/software/catdoc/ (2016) - ccze https://github.com/cornet/ccze (2011) +- csvtable https://github.com/wofr06/csvtable (2024) - djvutxt https://sourceforge.net/projects/djvu/ (2021) - docx2txt https://docx2txt.sourceforge.net/ (2014) - dvi2tty https://www.ctan.org/tex-archive/dviware/dvi2tty/ (2016) diff --git a/lesspipe.sh b/lesspipe.sh index fe193c8..029fc7a 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -587,6 +587,9 @@ isfinal () { has_cmd ccze && [[ $COLOR = *always ]] && ccze -A < "$1" return ;; csv) + msg "type -S for better display of very wide tables" + { has_cmd csvtable && csvtable -h >/dev/null 2>&1 && cmd=(csvtable "$1"); } || + { has_cmd csvlook && cmd=(csvlook -S "$1"); } || { has_cmd column && cmd=(istemp "column -s ,; -t" "$1"); } || { has_cmd pandoc && cmd=(pandoc -f csv -t plain "$1"); } ;; json)