config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyInput = fmt.Errorf("input must have at least name or path")

Functions

This section is empty.

Types

type Advanced added in v0.0.2

type Advanced struct {
	DevMode bool
	Updates string
}

Advanced settings. Mostly affects front end only.

type App added in v0.0.2

type App struct {
	IsWindows bool
	IsLinux   bool
	IsMac     bool
	Exe       string
	Home      string
}

App data is read only.

type Config

type Config struct {
	*logs.LogConfig
	Advanced
	App
	*logs.Logger
	File string
	Dark bool
}

Config is the data read and written to/from the config file.

func Get

func Get(input *Input) (*Config, error)

Get opens/reads or creates/writes a config file.

func New

func New(appName string, logger *logs.Logger) *Config

New returns a config with defaults.

func (*Config) Copy

func (c *Config) Copy() *Config

Copy returns a copy of the config data. Useful for updating the config file.

func (*Config) Update

func (c *Config) Update(merge *Config)

Update merges in a new config.

func (*Config) Write

func (c *Config) Write() error

Write writes the config file.

type Input

type Input struct {
	Path   string
	Name   string
	Dir    string
	Logger *logs.Logger
}

Input data to open a config file. If Dir!="" then config is placed in a sub directory.

Jump to

Keyboard shortcuts

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