cfg

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright © 2022 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

View Source
const (
	Extended = iota + 1
	Orgtbl
	Markdown
	Shell
	Yaml
	CSV
	Ascii
)

used for switching printers

View Source
const DefaultSeparator string = `(\s\s+|\t)`
View Source
const Version string = "v1.1.0"

Variables

View Source
var DefaultConfigfile string = os.Getenv("HOME") + "/.config/tablizer/config"
View Source
var DefaultLoadPath string = os.Getenv("HOME") + "/.config/tablizer/lisp"
View Source
var VERSION string // maintained by -x
View Source
var ValidHooks []string

valid lisp hooks

Functions

func ColorStringToBGColor added in v1.1.0

func ColorStringToBGColor(colorname string) color.Color

same, for background colors

func ColorStringToColor added in v1.1.0

func ColorStringToColor(colorname string) color.Color

translate color string to internal color value

func Getversion

func Getversion() string

Types

type Config

type Config struct {
	Debug          bool
	NoNumbering    bool
	NoHeaders      bool
	Columns        string
	UseColumns     []int
	Separator      string
	OutputMode     int
	InvertMatch    bool
	Pattern        string
	PatternR       *regexp.Regexp
	UseFuzzySearch bool
	UseHighlight   bool

	SortMode       string
	SortDescending bool
	SortByColumn   int

	/*
	 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

	// 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

	// config file, optional
	Configfile string

	Configuration Configuration
}

internal config

func (*Config) ApplyDefaults added in v1.0.12

func (c *Config) ApplyDefaults()

func (*Config) CheckEnv added in v1.0.12

func (c *Config) CheckEnv()

func (*Config) Colors added in v1.1.0

func (c *Config) Colors() map[color.Level]map[string]color.Color

default color schemes

func (*Config) DetermineColormode added in v1.0.12

func (c *Config) DetermineColormode()

find supported color mode, modifies config based on constants

func (*Config) ParseConfigfile added in v1.1.0

func (c *Config) ParseConfigfile() error

func (*Config) PrepareModeFlags

func (conf *Config) PrepareModeFlags(flag Modeflag)

func (*Config) PreparePattern added in v1.0.12

func (c *Config) PreparePattern(pattern string) error

func (*Config) PrepareSortFlags

func (conf *Config) PrepareSortFlags(flag Sortmode)

type Configuration added in v1.1.0

type Configuration 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

type Modeflag

type Modeflag struct {
	X bool
	O bool
	M bool
	S bool
	Y bool
	A bool
	C bool
}

maps outputmode short flags to output mode, ie. -O => -o orgtbl

type Sortmode

type Sortmode struct {
	Numeric bool
	Time    bool
	Age     bool
}

various sort types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL