Documentation
¶
Overview ¶
Package config manages options and settings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUserConfig ¶
CreateUserConfig builds configuration instance from default paths (/etc/logalize/..., ~/.config/logalize/... and ./.logalize.yaml) and other paths from userPaths variable (most likely these come from --config flag(s)).
Types ¶
type Options ¶
type Options struct {
ConfigPaths []string // path(s) to configuration file(s)
Theme string // the name of the theme to be used
Debug bool // add debug info to the output
NoBuiltinFormats bool // disable built-in formats
NoBuiltinPatterns bool // disable built-in patterns
NoBuiltinWords bool // disable built-in words
NoBuiltins bool // disable built-in formats, patterns and words
HighlightOnlyFormats bool // highlight only formats
HighlightOnlyPatterns bool // highlight only patterns
HighlightOnlyWords bool // highlight only words
DryRun bool // don't alter the input
NoANSIEscapeSequencesStripping bool // disable removing of ANSI escape sequences from the input
PrintConfig bool // print fully merged configuration file and exit the program
PrintBuiltins bool // print built-in configuration and exit the program
ListThemes bool // print all available themes and exit the program
}
Options stores the values of command-line and config options.
func NewOptions ¶
func NewOptions() *Options
NewOptions create new instance of Options with default values.
func (*Options) ReadFromConfig ¶
ReadFromConfig reads new options from configuration object and override corresponding fields in the *Option instance.
func (*Options) ReadFromFlags ¶
ReadFromFlags reads new options from command line flags and override corresponding fields in the *Option instance.
type Settings ¶
type Settings struct {
Config *koanf.Koanf
Opts Options
Builtins fs.FS
ColorProfile termenv.Profile
}
Settings is the representation of the whole application configuration.
func NewSettings ¶
NewSettings creates new Settings instance from built-ins (formats, patterns, words, etc.), user configuration (files in /etc/logalize/..., ~/.config/logalize and ./.logalize.yaml) and command line flags.
func (Settings) ProcessSpecialFlags ¶
ProcessSpecialFlags checks flags like --print-config and --list-themes that should produce some text output and then exit the program.