config

package
v0.0.0-...-7908a67 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config implements functions pertaining to configuration management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Editor

func Editor() (string, error)

Editor attempts to locate an editor that's appropriate for the environment.

func Init

func Init(confpath string, configs string) error

Init initializes a config file

func Pager

func Pager() string

Pager attempts to locate a pager that's appropriate for the environment.

func Path

func Path(paths []string) (string, error)

Path returns the config file path

func Paths

func Paths(
	sys string,
	home string,
	envvars map[string]string,
) ([]string, error)

Paths returns config file paths that are appropriate for the operating system

Types

type Config

type Config struct {
	Colorize   bool           `yaml:"colorize"`
	Editor     string         `yaml:"editor"`
	Cheatpaths []cp.Cheatpath `yaml:"cheatpaths"`
	Style      string         `yaml:"style"`
	Formatter  string         `yaml:"formatter"`
	Pager      string         `yaml:"pager"`
	Path       string
}

Config encapsulates configuration parameters

func New

func New(_ map[string]interface{}, confPath string, resolve bool) (Config, error)

New returns a new Config struct

func (*Config) Color

func (c *Config) Color(opts map[string]interface{}) bool

Color indicates whether colorization should be applied to the output

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is invalid

Jump to

Keyboard shortcuts

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