Compare commits

..

8 Commits

Author SHA1 Message Date
T. von Dein
e3b3cb3f70 fix-ascii-spacing (#51)
fix #50: remove excess spaces in normal ascii table output mode
2026-02-19 13:55:04 +01:00
2122805301 add highlight pattern screenshot 2026-01-20 13:07:16 +01:00
935f5cc28f add highlight screenshot 2026-01-20 13:04:24 +01:00
6e7b6c1a20 add interactive screenshot 2026-01-20 12:38:35 +01:00
e4ce325d98 restrict hw platforms to arm and amd 64 bit 2026-01-19 14:11:35 +01:00
1e9c23d5fa fix pod markup in markdown readme 2026-01-19 14:09:27 +01:00
6d92d70ea2 update synopsis 2026-01-19 14:08:02 +01:00
T. von Dein
834892e302 colorize-output using regexes, refactor line colorization (#49) 2026-01-19 14:05:28 +01:00
8 changed files with 50 additions and 37 deletions

View File

@@ -18,6 +18,9 @@ builds:
- windows
- darwin
- freebsd
goarch:
- amd64
- arm64
archives:
- formats: [tar.gz]

View File

@@ -45,17 +45,17 @@ Operational Flags:
-n, --numbering Enable header numbering
-N, --no-color Disable pattern highlighting
-H, --no-headers Disable headers display
-s, --separator <string> Custom field separator
-s, --separator <string> Custom field separator (maybe char, string or :class:)
-k, --sort-by <int|name> Sort by column (default: 1)
-z, --fuzzy Use fuzzy search [experimental]
-F, --filter <field[!]=reg> Filter given field with regex, can be used multiple times
-T, --transpose-columns string Transpose the speficied columns (separated by ,)
-R, --regex-transposer </from/to/> Apply /search/replace/ regexp to fields given in -T
-K --regex-colorizer /from/color/ colorize pattern of output (color: fg[:bg])
-j, --json Read JSON input (must be array of hashes)
-I, --interactive Interactively filter and select rows
--auto-headers Generate headers if there are none present in input
--custom-headers a,b,... Use custom headers, separated by comma
-g, --auto-headers Generate headers if there are none present in input
-x, --custom-headers a,b,... Use custom headers, separated by comma
Output Flags (mutually exclusive):
-X, --extended Enable extended output
@@ -63,12 +63,14 @@ Output Flags (mutually exclusive):
-O, --orgtbl Enable org-mode table output
-S, --shell Enable shell evaluable output
-Y, --yaml Enable yaml output
-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,
space separated
--ofs <char> Output field separator, used by -A and -C.
Sort Mode Flags (mutually exclusive):
-a, --sort-age sort according to age (duration) string
@@ -176,7 +178,7 @@ Here, we modified the 4th column (`-T4`) by replacing every space with
a dash. If you need to work with `/` characters, you can also use any
other separator, for instance: `-R '| |-|'`.
There's also an interactive mode, invoked with the option B<-I>, where
There's also an interactive mode, invoked with the option `-I`, where
you can interactively filter and select rows:
<img width="937" height="293" alt="interactive" src="https://github.com/user-attachments/assets/0d4d65e2-d156-43ed-8021-39047c7939ed" />

View File

@@ -28,7 +28,7 @@ import (
)
const (
Version = "v1.6.0"
Version = "v1.6.1"
MAXPARTS = 2
)

View File

@@ -255,7 +255,15 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
log.Fatalf("Failed to render table: %s", err)
}
output(writer, conf, color.Sprint(colorizeData(conf, tableString.String())))
// we need to trim our output here, because tablewriter appends
// excess whitespace to our rows.
cleanedString := &strings.Builder{}
for _, row := range strings.Split(tableString.String(), "\n") {
cleanedString.WriteString(strings.TrimSpace(row))
cleanedString.WriteString("\n")
}
output(writer, conf, color.Sprint(colorizeData(conf, cleanedString.String())))
}
/*

View File

@@ -1,5 +1,5 @@
/*
Copyright © 2022 Thomas von Dein
Copyright © 2022-2026 Thomas von Dein
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
@@ -23,8 +23,8 @@ import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"codeberg.org/scip/tablizer/cfg"
"github.com/stretchr/testify/assert"
)
func newData() Tabdata {

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB