mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
add template output mode
This commit is contained in:
45
tablizer.1
45
tablizer.1
@@ -133,7 +133,7 @@
|
||||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "TABLIZER 1"
|
||||
.TH TABLIZER 1 "2025-10-13" "1" "User Commands"
|
||||
.TH TABLIZER 1 "2025-12-08" "1" "User Commands"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.if n .ad l
|
||||
@@ -172,6 +172,7 @@ tablizer \- Manipulate tabular output of other programs
|
||||
\& \-J, \-\-jsonout Enable JSON output
|
||||
\& \-C, \-\-csv Enable CSV output
|
||||
\& \-A, \-\-ascii Default output mode, ascii tabular
|
||||
\& \-P, \-\-template <tpl> Enable template mode with template <tpl>
|
||||
\& \-L, \-\-hightlight\-lines Use alternating background colors for tables
|
||||
\& \-o, \-\-ofs <char> Output field separator, used by \-A and \-C.
|
||||
\& \-y, \-\-yank\-columns Yank specified columns (separated by ,) to clipboard,
|
||||
@@ -219,16 +220,16 @@ pattern. Hence:
|
||||
.PP
|
||||
.Vb 2
|
||||
\& # read from STDIN
|
||||
\& kubectl get pods | tablizer
|
||||
\& > kubectl get pods | tablizer
|
||||
\&
|
||||
\& # read a file
|
||||
\& tablizer \-r filename
|
||||
\& > tablizer \-r filename
|
||||
\&
|
||||
\& # search for pattern in a file (works like grep)
|
||||
\& tablizer regex \-r filename
|
||||
\& > tablizer regex \-r filename
|
||||
\&
|
||||
\& # search for pattern in STDIN
|
||||
\& kubectl get pods | tablizer regex
|
||||
\& > kubectl get pods | tablizer regex
|
||||
.Ve
|
||||
.PP
|
||||
The output looks like the original one. You can add the option \fB\-n\fR,
|
||||
@@ -242,7 +243,7 @@ These numbers denote the column and you can use them to specify which
|
||||
columns you want to have in your output (see \s-1COLUMNS\s0:
|
||||
.PP
|
||||
.Vb 1
|
||||
\& kubectl get pods | tablizer \-c1,3
|
||||
\& > kubectl get pods | tablizer \-c1,3
|
||||
.Ve
|
||||
.PP
|
||||
You can specify the numbers in any order but output will always follow
|
||||
@@ -252,13 +253,13 @@ However, you may also just use the header names instead of numbers,
|
||||
eg:
|
||||
.PP
|
||||
.Vb 1
|
||||
\& kubectl get pods | tablizer \-cname,status
|
||||
\& > kubectl get pods | tablizer \-cname,status
|
||||
.Ve
|
||||
.PP
|
||||
You can also use regular expressions with \fB\-c\fR, eg:
|
||||
.PP
|
||||
.Vb 1
|
||||
\& kubectl get pods | tablizer \-c \*(Aq[ae]\*(Aq
|
||||
\& > kubectl get pods | tablizer \-c \*(Aq[ae]\*(Aq
|
||||
.Ve
|
||||
.PP
|
||||
By default tablizer shows a header containing the names of each
|
||||
@@ -381,7 +382,7 @@ and append the flag. The following flags are supported:
|
||||
Example for a case insensitive search:
|
||||
.PP
|
||||
.Vb 1
|
||||
\& kubectl get pods \-A | tablizer "/account/i"
|
||||
\& > kubectl get pods \-A | tablizer "/account/i"
|
||||
.Ve
|
||||
.PP
|
||||
If you use the \f(CW\*(C`!\*(C'\fR flag, then the regex match will be negated, that
|
||||
@@ -460,7 +461,7 @@ Lets take this table:
|
||||
We want to see only the \s-1CMD\s0 column and use a regex for this:
|
||||
.PP
|
||||
.Vb 6
|
||||
\& ps | tablizer \-s \*(Aq\es+\*(Aq \-c C
|
||||
\& > ps | tablizer \-s \*(Aq\es+\*(Aq \-c C
|
||||
\& CMD(4)
|
||||
\& bash
|
||||
\& ps
|
||||
@@ -497,7 +498,7 @@ use a regexp containing the \f(CW\*(C`/\*(C'\fR character, eg:
|
||||
Example:
|
||||
.PP
|
||||
.Vb 7
|
||||
\& cat t/testtable2
|
||||
\& > cat t/testtable2
|
||||
\& NAME DURATION
|
||||
\& x 10
|
||||
\& a 100
|
||||
@@ -505,7 +506,7 @@ Example:
|
||||
\& u 4
|
||||
\& k 6
|
||||
\&
|
||||
\& cat t/testtable2 | tablizer \-T2 \-R \*(Aq/^\ed/4/\*(Aq \-n
|
||||
\& > cat t/testtable2 | tablizer \-T2 \-R \*(Aq/^\ed/4/\*(Aq \-n
|
||||
\& NAME DURATION
|
||||
\& x 40
|
||||
\& a 400
|
||||
@@ -523,7 +524,7 @@ printed vertically, header left, value right, aligned by the field
|
||||
widths. Here's an example:
|
||||
.PP
|
||||
.Vb 6
|
||||
\& kubectl get pods | ./tablizer \-o extended
|
||||
\& > kubectl get pods | ./tablizer \-o extended
|
||||
\& NAME: repldepl\-7bcd8d5b64\-7zq4l
|
||||
\& READY: 1/1
|
||||
\& STATUS: Running
|
||||
@@ -539,7 +540,7 @@ by the shell, it prints variable assignments for each cell, one line
|
||||
per row:
|
||||
.PP
|
||||
.Vb 4
|
||||
\& kubectl get pods | ./tablizer \-o extended ./tablizer \-o shell
|
||||
\& > kubectl get pods | ./tablizer \-o extended ./tablizer \-o shell
|
||||
\& NAME="repldepl\-7bcd8d5b64\-7zq4l" READY="1/1" STATUS="Running" RESTARTS="9 (47m ago)" AGE="4d23h"
|
||||
\& NAME="repldepl\-7bcd8d5b64\-m48n8" READY="1/1" STATUS="Running" RESTARTS="9 (47m ago)" AGE="4d23h"
|
||||
\& NAME="repldepl\-7bcd8d5b64\-q2bf4" READY="1/1" STATUS="Running" RESTARTS="9 (47m ago)" AGE="4d23h"
|
||||
@@ -550,8 +551,22 @@ You can use this in an eval loop.
|
||||
Beside normal ascii mode (the default) and extended mode there are
|
||||
more output modes available: \fBorgtbl\fR which prints an Emacs org-mode
|
||||
table and \fBmarkdown\fR which prints a Markdown table, \fByaml\fR, which
|
||||
prints yaml encoding and \s-1CSV\s0 mode, which prints a comma separated
|
||||
prints yaml encoding and \fB\s-1CSV\s0\fR mode, which prints a comma separated
|
||||
value file.
|
||||
.PP
|
||||
A special output mode ist the \fBTemplate\fR mode, activated with the
|
||||
option \f(CW\*(C`\-\-template\*(C'\fR. Template language is the Golang template
|
||||
language: <https://pkg.go.dev/text/template>. You can also use lot's
|
||||
of additional functions from:
|
||||
<https://masterminds.github.io/sprig/>. Here's an example:
|
||||
.PP
|
||||
.Vb 3
|
||||
\& > kubectl get pods | tablizer \-\-template "{{.name}} is {{.status}}"
|
||||
\& alertmanager\-kube\-prometheus\-alertmanager\-0 is Running
|
||||
\& grafana\-fcc54cbc9\-bk7s8 is Running
|
||||
.Ve
|
||||
.PP
|
||||
You can use header names as variables.
|
||||
.SS "\s-1PUT FIELDS TO CLIPBOARD\s0"
|
||||
.IX Subsection "PUT FIELDS TO CLIPBOARD"
|
||||
You can let tablizer put fields to the clipboard using the option
|
||||
|
||||
Reference in New Issue
Block a user