чување 602856c49fa6e308543b6f19b9f0558eec239c3d
родитељ c96f6e42cf6a8b10b0d5fa05f8e238bd4cd5506b
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sun, 3 Oct 2021 11:33:44 +0200
README: Add information how to set table as a TSV viewer; index.html: Remove file
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 6, додавања: 34(+), брисања: 290(-)
diff --git a/README b/README
@@ -59,10 +59,23 @@ $ su
edit ~/.config/mc/mc.ext and add the lines:
shell/.csv
- View=%view{ascii} ~/bin/text.sh view csv %var{PAGER:more}</pre>
+ View=%view{ascii} ~/bin/text.sh view csv %var{PAGER:more}
before includes and default target.
+ Bonus – TSV viewer: include
+
+ tsv)
+ table -m -d "$(printf '\t')" -n "${MC_EXT_FILENAME}"
+ ;;
+
+ in ~/bin/text.sh and
+
+ shell/.tsv
+ View=%view{ascii} ~/bin/text.sh view tsv %var{PAGER:more}
+
+ in ~/.config/mc/mc.ext.
+
Configuring ranger file manager
-------------------------------
@@ -76,6 +89,13 @@ $ su
table -m "${FILE_PATH}" && exit 5
exit 1;;
+ Bonus – TSV viewer:
+
+ ## TSV
+ tsv)
+ table -m -d "$(printf '\t')" "${FILE_PATH}" && exit 5
+ exit 1;;
+
Configuring vifm
----------------
@@ -88,6 +108,12 @@ $ su
fileviewer *.csv
\ table -m %c
+ Bonus – TSV viewer:
+
+ " TSV
+ fileviewer *.tsv
+ \ table -m -d "$(printf '\t')" %c
+
[1]: https://github.com/apenwarr/redo
[2]: https://www.midnight-commander.org
@@ -113,4 +139,3 @@ $ su
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-
diff --git a/TODO b/TODO
@@ -12,4 +12,3 @@
[~] = partially done
[x] = fully done
[/] = eventually decided not to do
-
diff --git a/all.do b/all.do
@@ -1 +1 @@
-redo-ifchange version.h table table.1.gz table.pdf
+redo-ifchange version.h table table.1.gz
diff --git a/clean.do b/clean.do
@@ -1,2 +1,2 @@
redo-always
-rm -f table table.1 table.1.gz *.o *~ *.pdf
+rm -f table table.1 table.1.gz *.o *~
diff --git a/index.html b/index.html
@@ -1,281 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <title>table - Command line utility to format and display CSV</title>
- <link rel="canonical" href="https://strahinja.srht.site/table/index.html" />
- <meta name="description" content="Command line utility to format and display CSV" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <style>
- html, body, html *
- {
- font-family: "Noto Sans", "Helvetica", "Arial", sans-serif;
- font-weight: normal;
- font-size: 11pt;
- }
-
- body
- {
- display: flex;
- flex-direction: column;
- }
-
- body
- {
- max-width: 1024px;
- margin: 0 auto;
- }
-
- @media(prefers-color-scheme: dark)
- {
- html,
- body
- {
- color: #fff;
- background-color: #121212;
- }
-
- a,
- a:link,
- a:active,
- a:visited
- {
- color: #aaf;
- }
- }
-
- @media(max-width: 1024px)
- {
- body
- {
- max-width: 100%;
- margin: 0 1em;
- }
- }
-
- @media(max-width: 960px)
- {
- body > *
- {
- width: 100%;
- max-width: initial;
- }
- }
-
- h1, h2, h3, h4, h5
- {
- font-weight: bold;
- }
-
- h1
- {
- font-size: 2.25em;
- }
-
- h2
- {
- font-size: 1.5em;
- font-variant: small-caps;
- }
-
- h3
- {
- font-size: 1.2em;
- }
-
- code, pre, pre *
- {
- font-family: "Noto Mono", "Courier New", "Courier", monospace;
- }
-
- pre
- {
- overflow-x: auto;
- padding: 0 2em;
- }
-
- .example
- {
- margin-top: .5em;
- margin-bottom: 1em;
- }
-
- .explanation
- {
- margin-bottom: .5em;
- margin-top: 1em;
- }
- </style>
- </head>
- <body>
- <h1>table</h1>
-
- <p>Command line utility to format and display CSV.</p>
-
- <h2>Prerequisites</h2>
-
- <p>C compiler, preferably <strong>GNU C</strong> or similar, <a
- href="https://www.gnu.org/software/libunistring/">GNU
- libunistring</a>.</p>
-
- <h2>Install</h2>
-
- <pre>
-$ git clone <a
-href="https://git.sr.ht/~strahinja/table">https://git.sr.ht/~strahinja/table</a>
-$ cd table
-$ su
- </pre>
-
- <p>Then, if you have <a href="https://github.com/apenwarr/redo">apenwarr/redo</a>:</p>
-
- <pre>
-# redo install
- </pre>
-
- <p>if you don't:</p>
-
- <pre>
-# ./do install
- </pre>
-
- <h2>Examples</h2>
-
- <p class="explanation">Periodically display CPU load information in a
- single-line table</p>
-
- <pre class="example">
-$ watch "table /proc/loadavg -d ' ' -c 50 -n -s ss"</pre>
-
- <p class="explanation">Format a long list of files in the current
- directory in a double line table with single-line column divisors</p>
-
- <pre class="example">
-$ LC_ALL=C ls -l | tail -n +2 | sed -e 's/ \+/ /g' | table -d ' ' -n</pre>
-
- <p class="explanation">Like the above, but only permissions and file
- names are printed in a narrow table</p>
-
- <pre class="example">
-$ LC_ALL=C ls -l | tail -n +2 | awk '{ print $1 " " $9 }' | table -d ' ' -c 30 -n</pre>
-
- <h2>Configuring GNU Midnight Commander (mc)</h2>
-
- <p><a href="https://www.midnight-commander.org">GNU Midnight
- Commander</a> file manager can be configured to use table as a
- viewer (F3) for CSV files. To do that, edit
- <code>/usr/lib/mc/ext.d/text.sh</code> (or make and edit a local copy,
- for example in <code>~/bin/text.sh</code>, which we will assume here) so
- that</p>
-
- <pre>
-case "${filetype}" in</pre>
-
- <p>block in <code>do_view_action()</code> function includes:</p>
-
- <pre>
- csv)
- table -m -n "${MC_EXT_FILENAME}"
- ;;</pre>
-
- <p>You also need to edit extension file (Command->Edit extension
- file) or just edit <code>~/.config/mc/mc.ext</code> and add the
- lines:</p>
-
- <pre>
-shell/.csv
- View=%view{ascii} ~/bin/text.sh view csv %var{PAGER:more}</pre>
-
- <p>before includes and default target.</p>
-
- <h2>Configuring ranger file manager</h2>
-
- <p><a href="https://github.com/ranger/ranger">Ranger</a> file manager
- can be configured to use table as a CSV file viewer. To do that, add the
- following to <code>~/.config/ranger/scope.sh</code>, within the function
- <code>handle_extension()</code>:</p>
-
- <pre>
-## CSV
-csv)
- table -m "${FILE_PATH}" && exit 5
- exit 1;;</pre>
-
- <h2>Configuring vifm</h2>
-
- <p><a href="https://vifm.info">Vifm</a> file manager can also be
- configured to use table as a CSV file viewer. To accomplish this, add
- the following lines to <code>~/.config/vifm/vifmrc</code>:
-
- <pre>
-" CSV
-fileviewer *.csv
- \ table -m %c</pre>
-
-
- <h2>Changelog</h2>
-
- <h3>v0.2.2</h3>
- <ul>
- <li>Optimizations and bugfixes</li>
- <li>Added description how to configure table as a viewer for GNU MC</li>
- <li>Added the --msdos option</li>
- <li>Changed URLs to sourcehut</li>
- </ul>
-
- <h3>v0.2.1</h3>
- <ul>
- <li>Added format support</li>
- </ul>
-
- <h3>v0.2</h3>
- <ul>
- <li>Switched to apenwarr/redo</li>
- <li>Core code rewrite. Prevented leaks with valgrind</li>
- <li>New examples directory, updated scripts in tests</li>
- <li>Updated manpage</li>
- </ul>
-
- <h3>v0.1.2-beta</h3>
- <ul>
- <li>Add --border-mode</li>
- <li>Fix last row in ls -mw30 | table when last input line has only
- one column</li>
- </ul>
-
- <h3>v0.1.1-beta</h3>
- <ul>
- <li>Ignore malformed UTF-8 sequences. Segmentation faulted
- (test/who-Huw.sh with LC_ALL=sr_RS.UTF8 and cyrillic user
- names)</li>
- <li>Use "T" connector chars; connector selection similar to -s</li>
- </ul>
-
- <h3>v0.1-alpha</h3>
- <ul>
- <li>Read and display columns</li>
- <li>Handle tabs - unwrap to spaces at tab stops
- (test/lsb_release.sh)</li>
- <li>Better UTF-8 substring code based on screen columns</li>
- </ul>
-
- <h2>License</h2>
-
- <p>table - Command line utility to format and display CSV.<br />
- Copyright (C) 2020, 2021 Страхиња Радић</p>
-
- <p>This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation, either version 3 of the License, or (at your
- option) any later version.</p>
-
- <p>This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- Public License for more details.</p>
-
- <p>You should have received a copy of the GNU General Public License
- along with this program. If not, see <a
- href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
- </body>
-</html>
diff --git a/install.do b/install.do
@@ -1,9 +1,10 @@
redo-ifchange all
-PREFIX=/usr/local
+PREFIX=${PREFIX:-/usr/local}
BINDIR=$PREFIX/bin
-DOCDIR=$PREFIX/share/doc/table
+#DOCDIR=$PREFIX/share/doc/table
MANDIR=$PREFIX/share/man/man1
-install -d $BINDIR $DOCDIR $MANDIR
+#install -d $DOCDIR
+install -d $BINDIR $MANDIR
install -m 0755 table $BINDIR
-install -m 0644 table.pdf $DOCDIR
+#install -m 0644 table.pdf $DOCDIR
install -m 0644 table.1.gz $MANDIR