Release v1.0.17 (#9)

* add shortcut -H to --no-headers, it's too cumbersome to type
* added fuzzy search support
* Added basic lisp plugin facilities
* Lisp plugin Addidions:
- added process hook facilities
- added working example lisp plugin for filter hook
- load-path can now be a file as well
- added a couple of lisp helper functions (atoi, split), more may
  follow, see lisplib.go
* linting fixes
This commit is contained in:
T.v.Dein
2023-10-02 18:15:41 +02:00
committed by GitHub
parent 93800f81c1
commit 9eadb941da
15 changed files with 615 additions and 37 deletions

View File

@@ -22,25 +22,30 @@ import (
"os"
"regexp"
"github.com/glycerine/zygomys/zygo"
"github.com/gookit/color"
)
const DefaultSeparator string = `(\s\s+|\t)`
const Version string = "v1.0.16"
const Version string = "v1.0.17"
var DefaultLoadPath string = os.Getenv("HOME") + "/.config/tablizer/lisp"
var VERSION string // maintained by -x
type Config struct {
Debug bool
NoNumbering bool
NoHeaders bool
Columns string
UseColumns []int
Separator string
OutputMode int
InvertMatch bool
Pattern string
PatternR *regexp.Regexp
Debug bool
NoNumbering bool
NoHeaders bool
Columns string
UseColumns []int
Separator string
OutputMode int
InvertMatch bool
Pattern string
PatternR *regexp.Regexp
UseFuzzySearch bool
SortMode string
SortDescending bool
@@ -53,6 +58,13 @@ type Config struct {
ColorStyle color.Style
NoColor bool
// special case: we use the config struct to transport the lisp
// env trough the program
Lisp *zygo.Zlisp
// a path containing lisp scripts to be loaded on startup
LispLoadPath string
}
// maps outputmode short flags to output mode, ie. -O => -o orgtbl
@@ -84,6 +96,9 @@ type Sortmode struct {
Age bool
}
// valid lisp hooks
var ValidHooks []string
// default color schemes
func Colors() map[color.Level]map[string]color.Color {
return map[color.Level]map[string]color.Color{
@@ -186,6 +201,8 @@ func (c *Config) ApplyDefaults() {
if c.OutputMode == Yaml || c.OutputMode == CSV {
c.NoNumbering = true
}
ValidHooks = []string{"filter", "process", "transpose", "append"}
}
func (c *Config) PreparePattern(pattern string) error {