Documentation
¶
Overview ¶
Copyright © 2022-2025 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
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.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func ColorStringToBGColor(colorname string) color.Color
- func ColorStringToColor(colorname string) color.Color
- func Getversion() string
- type Config
- func (conf *Config) ApplyDefaults()
- func (conf *Config) CheckEnv()
- func (conf *Config) Colors() map[color.Level]map[string]color.Color
- func (conf *Config) DetermineColormode()
- func (conf *Config) ParseConfigfile() error
- func (conf *Config) PrepareFilters() error
- func (conf *Config) PrepareModeFlags(flag Modeflag)
- func (conf *Config) PreparePattern(patterns []*Pattern) error
- func (conf *Config) PrepareSortFlags(flag Sortmode)
- func (conf *Config) PrepareTransposers() error
- type Filter
- type Modeflag
- type Pattern
- type Settings
- type Sortmode
- type Transposer
Constants ¶
const ( Extended = iota + 1 Orgtbl Markdown Shell Yaml CSV ASCII )
used for switching printers
const DefaultSeparator string = `(\s\s+|\t)`
const MAXPARTS = 2
const Version string = "v1.3.3"
Variables ¶
var DefaultConfigfile = os.Getenv("HOME") + "/.config/tablizer/config"
var VERSION string // maintained by -x
Functions ¶
func ColorStringToBGColor ¶ added in v1.1.0
same, for background colors
func ColorStringToColor ¶ added in v1.1.0
translate color string to internal color value
func Getversion ¶
func Getversion() string
main program version generated version string, used by -v contains lib.Version on
main branch, and lib.Version-$branch-$lastcommit-$date on
development branch
Types ¶
type Config ¶
type Config struct { Debug bool NoNumbering bool NoHeaders bool Columns string UseColumns []int YankColumns string UseYankColumns []int Separator string OutputMode int InvertMatch bool Patterns []*Pattern UseFuzzySearch bool UseHighlight bool SortMode string SortDescending bool SortByColumn string // 1,2 UseSortByColumn []int // []int{1,2} TransposeColumns string // 1,2 UseTransposeColumns []int // []int{1,2} Transposers []string // []string{"/ /-/", "/foo/bar/"} UseTransposers []Transposer // {Search: re, Replace: string} /* FIXME: make configurable somehow, config file or ENV see https://github.com/gookit/color. */ ColorStyle color.Style HighlightStyle color.Style NoHighlightStyle color.Style HighlightHdrStyle color.Style NoColor bool // config file, optional Configfile string Settings Settings // used for field filtering Rawfilters []string Filters map[string]Filter //map[string]*regexp.Regexp // -r <file> InputFile string }
internal config
func (*Config) ApplyDefaults ¶ added in v1.0.12
func (conf *Config) ApplyDefaults()
func (*Config) DetermineColormode ¶ added in v1.0.12
func (conf *Config) DetermineColormode()
find supported color mode, modifies config based on constants
func (*Config) ParseConfigfile ¶ added in v1.1.0
Parse config file. Ignore if the file doesn't exist but return an error if it exists but fails to read or parse
func (*Config) PrepareFilters ¶ added in v1.2.0
func (*Config) PrepareModeFlags ¶
func (*Config) PreparePattern ¶ added in v1.0.12
func (*Config) PrepareSortFlags ¶
func (*Config) PrepareTransposers ¶ added in v1.3.0
check if transposers match transposer columns and prepare transposer structs
type Settings ¶ added in v1.2.0
type Settings struct { FG string `hcl:"FG"` BG string `hcl:"BG"` HighlightFG string `hcl:"HighlightFG"` HighlightBG string `hcl:"HighlightBG"` NoHighlightFG string `hcl:"NoHighlightFG"` NoHighlightBG string `hcl:"NoHighlightBG"` HighlightHdrFG string `hcl:"HighlightHdrFG"` HighlightHdrBG string `hcl:"HighlightHdrBG"` }
public config, set via config file or using defaults