Made corrections to satisfy linter.

This commit is contained in:
2022-10-14 19:51:19 +02:00
parent 8e2ba58ddb
commit 745d15b459
10 changed files with 39 additions and 34 deletions

View File

@@ -36,6 +36,7 @@ all: $(tool).1 cmd/$(tool).go buildlocal
cmd/%.go: %.pod
echo "package cmd" > cmd/$*.go
echo >> cmd/$*.go
echo "var manpage = \`" >> cmd/$*.go
pod2text $*.pod >> cmd/$*.go
echo "\`" >> cmd/$*.go

View File

@@ -1,5 +1,6 @@
[![Actions](https://github.com/tlinden/tablizer/actions/workflows/ci.yaml/badge.svg)](https://github.com/tlinden/tablizer/actions)
[![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://github.com/tlinden/tablizer/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/tlinden/tablizer)](https://goreportcard.com/report/github.com/tlinden/tablizer)
## tablizer - Manipulate tabular output of other programs

View File

@@ -1,4 +1,5 @@
package cmd
var manpage = `
NAME
tablizer - Manipulate tabular output of other programs
@@ -37,7 +38,7 @@ DESCRIPTION
You can use tablizer to do these and more things.
tablizer analyses the header fiels of a table, registers the column
tablizer analyses the header fields of a table, registers the column
positions of each header field and separates columns by those positions.
Without any options it reads its input from "STDIN", but you can also
@@ -79,7 +80,7 @@ DESCRIPTION
(as in GNU sort(1)). The default sort column is the first one. To
disable sorting at all, supply 0 (Zero) to -k.
Finally the -d option enables debugging output which is mostly usefull
Finally the -d option enables debugging output which is mostly useful
for the developer.
PATTERNS
@@ -102,14 +103,14 @@ DESCRIPTION
"i" ignore case "m" multiline mode "s" single line mode
Example for a case insensitve search:
Example for a case insensitive search:
kubectl get pods -A | tablizer "(?i)account"
OUTPUT MODES
There might be cases when the tabular output of a program is way too
large for your current terminal but you still need to see every column.
In such cases the -o extended or -X option can be usefull which enables
In such cases the -o extended or -X option can be useful which enables
*extended mode*. In this mode, each row will be printed vertically,
header left, value right, aligned by the field widths. Here's an
example:

View File

@@ -52,13 +52,13 @@ var (
// colors to be used per supported color mode
Colors = map[color.Level]map[string]string{
color.Level16: map[string]string{
color.Level16: {
"bg": "green", "fg": "black",
},
color.Level256: map[string]string{
color.Level256: {
"bg": "lightGreen", "fg": "black",
},
color.LevelRgb: map[string]string{
color.LevelRgb: {
// FIXME: maybe use something nicer
"bg": "lightGreen", "fg": "black",
},
@@ -68,7 +68,7 @@ var (
validOutputmodes = "(orgtbl|markdown|extended|ascii)"
// main program version
Version = "v1.0.8"
Version = "v1.0.9"
// generated version string, used by -v contains lib.Version on
// main branch, and lib.Version-$branch-$lastcommit-$date on

View File

@@ -87,7 +87,7 @@ func reduceColumns(data *Tabdata) {
// exclude columns, if any
if len(Columns) > 0 {
reducedEntries := [][]string{}
reducedEntry := []string{}
var reducedEntry []string
for _, entry := range data.entries {
reducedEntry = nil
for i, value := range entry {

View File

@@ -79,15 +79,15 @@ func TestReduceColumns(t *testing.T) {
columns []int
}{
{
expect: [][]string{[]string{"a", "b"}},
expect: [][]string{{"a", "b"}},
columns: []int{1, 2},
},
{
expect: [][]string{[]string{"a", "c"}},
expect: [][]string{{"a", "c"}},
columns: []int{1, 3},
},
{
expect: [][]string{[]string{"a"}},
expect: [][]string{{"a"}},
columns: []int{1},
},
{
@@ -96,7 +96,7 @@ func TestReduceColumns(t *testing.T) {
},
}
input := [][]string{[]string{"a", "b", "c"}}
input := [][]string{{"a", "b", "c"}}
Columns = "y" // used as a flag with len(Columns)...

View File

@@ -35,10 +35,10 @@ func TestParser(t *testing.T) {
"ONE", "TWO", "THREE",
},
entries: [][]string{
[]string{
{
"asd", "igig", "cxxxncnc",
},
[]string{
{
"19191", "EDD 1", "X",
},
},
@@ -69,7 +69,7 @@ func TestParserPatternmatching(t *testing.T) {
}{
{
entries: [][]string{
[]string{
{
"asd", "igig", "cxxxncnc",
},
},
@@ -78,7 +78,7 @@ func TestParserPatternmatching(t *testing.T) {
},
{
entries: [][]string{
[]string{
{
"19191", "EDD 1", "X",
},
},

View File

@@ -52,10 +52,10 @@ func TestPrinter(t *testing.T) {
"ONE", "TWO", "THREE",
},
entries: [][]string{
[]string{
{
"asd", "igig", "cxxxncnc",
},
[]string{
{
"19191", "EDD 1", "X",
},
},
@@ -100,7 +100,9 @@ THREE(3): X`,
t.Run(testname, func(t *testing.T) {
OutputMode = mode
data := startdata // we need to reset our mock data, since it's being modified in printData()
// we need to reset our mock data, since it's being
// modified in printData()
data := startdata
printData(&data)
buf := make([]byte, 1024)
@@ -136,13 +138,13 @@ func TestSortPrinter(t *testing.T) {
"ONE", "TWO", "THREE",
},
entries: [][]string{
[]string{
{
"abc", "345", "b1",
},
[]string{
{
"bcd", "234", "a2",
},
[]string{
{
"cde", "123", "c3",
},
},

View File

@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "TABLIZER 1"
.TH TABLIZER 1 "2022-10-13" "1" "User Commands"
.TH TABLIZER 1 "2022-10-14" "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
@@ -177,8 +177,8 @@ not easy to process.
.PP
You can use \fBtablizer\fR to do these and more things.
.PP
\&\fBtablizer\fR analyses the header fiels of a table, registers the column
positions of each header field and separates columns by those
\&\fBtablizer\fR analyses the header fields of a table, registers the
column positions of each header field and separates columns by those
positions.
.PP
Without any options it reads its input from \f(CW\*(C`STDIN\*(C'\fR, but you can also
@@ -228,7 +228,7 @@ data (as in \s-1GNU\s0 \fBsort\fR\|(1)). The default sort column is the first on
disable sorting at all, supply 0 (Zero) to \-k.
.PP
Finally the \fB\-d\fR option enables debugging output which is mostly
usefull for the developer.
useful for the developer.
.SS "\s-1PATTERNS\s0"
.IX Subsection "PATTERNS"
You can reduce the rows being displayed by using a regular expression
@@ -256,7 +256,7 @@ The most important modifiers are:
\&\f(CW\*(C`m\*(C'\fR multiline mode
\&\f(CW\*(C`s\*(C'\fR single line mode
.PP
Example for a case insensitve search:
Example for a case insensitive search:
.PP
.Vb 1
\& kubectl get pods \-A | tablizer "(?i)account"
@@ -266,7 +266,7 @@ Example for a case insensitve search:
There might be cases when the tabular output of a program is way too
large for your current terminal but you still need to see every
column. In such cases the \fB\-o extended\fR or \fB\-X\fR option can be
usefull which enables \fIextended mode\fR. In this mode, each row will be
useful which enables \fIextended mode\fR. In this mode, each row will be
printed vertically, header left, value right, aligned by the field
widths. Here's an example:
.PP

View File

@@ -39,8 +39,8 @@ not easy to process.
You can use B<tablizer> to do these and more things.
B<tablizer> analyses the header fiels of a table, registers the column
positions of each header field and separates columns by those
B<tablizer> analyses the header fields of a table, registers the
column positions of each header field and separates columns by those
positions.
Without any options it reads its input from C<STDIN>, but you can also
@@ -84,7 +84,7 @@ data (as in GNU sort(1)). The default sort column is the first one. To
disable sorting at all, supply 0 (Zero) to -k.
Finally the B<-d> option enables debugging output which is mostly
usefull for the developer.
useful for the developer.
=head2 PATTERNS
@@ -109,7 +109,7 @@ C<i> ignore case
C<m> multiline mode
C<s> single line mode
Example for a case insensitve search:
Example for a case insensitive search:
kubectl get pods -A | tablizer "(?i)account"
@@ -119,7 +119,7 @@ Example for a case insensitve search:
There might be cases when the tabular output of a program is way too
large for your current terminal but you still need to see every
column. In such cases the B<-o extended> or B<-X> option can be
usefull which enables I<extended mode>. In this mode, each row will be
useful which enables I<extended mode>. In this mode, each row will be
printed vertically, header left, value right, aligned by the field
widths. Here's an example: