cfg

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: MPL-2.0 Imports: 10 Imported by: 95

Documentation

Index

Constants

View Source
const ConfigDirV1 = "~/.wtf/"

ConfigDirV1 defines the path to the first version of configuration. Do not use this

View Source
const ConfigDirV2 = "~/.config/wtf/"

ConfigDirV2 defines the path to the second version of the configuration. Use this.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the absolute path to the configuration directory

func Copy added in v0.0.10

func Copy(src, dest string) error

Copy copies src to dest, doesn't matter if src is a directory or a file

func CreateConfigDir

func CreateConfigDir()

CreateConfigDir creates the wtf/ directory in the user's home dir

func CreateConfigFile added in v0.0.9

func CreateConfigFile()

CreateConfigFile creates a simple config file in the config directory if one does not already exist

func CreateFile

func CreateFile(fileName string) (string, error)

CreateFile creates the named file in the config directory, if it does not already exist. If the file exists it does not recreate it. If successful, eturns the absolute path to the file If unsuccessful, returns an error

func LoadConfigFile

func LoadConfigFile(filePath string) *config.Config

LoadConfigFile loads the config.yml file to configure the app

func MigrateOldConfig added in v0.0.10

func MigrateOldConfig()

MigrateOldConfig copies any existing configuration from the old location to the new, XDG-compatible location

Types

type Colors added in v0.9.2

type Colors struct {
	Background      string
	BorderFocusable string
	BorderFocused   string
	BorderNormal    string
	Checked         string
	Foreground      string
	HighlightFore   string
	HighlightBack   string
	Text            string
	Title           string

	Rows struct {
		Even string
		Odd  string
	}
}

type Common added in v0.9.2

type Common struct {
	Colors
	Module
	PositionSettings `help:"Defines where in the grid this module’s widget will be displayed."`
	Sigils

	Bordered        bool   `help:"Whether or not the module should be displayed with a border." values:"true, false" optional:"true" default:"true"`
	Enabled         bool   `` /* 134-byte string literal not displayed */
	RefreshInterval int    `help:"How often, in seconds, this module will update its data." values:"A positive integer, 0..n." optional:"true"`
	Title           string `help:"The title string to show when displaying this module" optional:"true"`
	Config          *config.Config
	// contains filtered or unexported fields
}

func NewCommonSettingsFromModule added in v0.9.2

func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config.Config, globalSettings *config.Config) *Common

func (*Common) DefaultFocusedRowColor added in v0.14.0

func (common *Common) DefaultFocusedRowColor() string

func (*Common) DefaultRowColor added in v0.9.2

func (common *Common) DefaultRowColor() string

func (*Common) FocusChar added in v0.9.2

func (common *Common) FocusChar() string

func (*Common) RightAlignFormat added in v0.9.2

func (common *Common) RightAlignFormat(width int) string

func (*Common) RowColor added in v0.9.2

func (common *Common) RowColor(idx int) string

func (*Common) SigilStr added in v0.9.2

func (common *Common) SigilStr(len, pos int, width int) string

func (*Common) Validations added in v0.14.0

func (common *Common) Validations() []Validatable

Validations aggregates all the validations from all the sub-sections in Common into a single array of validations

type Module added in v0.9.2

type Module struct {
	Name string
	Type string
}

type PositionSettings added in v0.14.0

type PositionSettings struct {
	Validations *Validations

	Height int
	Left   int
	Top    int
	Width  int
}

PositionSettings represents the onscreen location of a widget

func NewPositionSettingsFromYAML added in v0.14.0

func NewPositionSettingsFromYAML(moduleName string, moduleConfig *config.Config) PositionSettings

NewPositionSettingsFromYAML creates and returns a new instance of cfg.Position

type Sigils added in v0.9.2

type Sigils struct {
	Checkbox struct {
		Checked   string
		Unchecked string
	}
	Paging struct {
		Normal   string
		Selected string
	}
}

type Validatable added in v0.14.0

type Validatable interface {
	Error() error
	HasError() bool
	String() string
	IntValue() int
}

Validatable is implemented by any value that validates a configuration setting

type Validations added in v0.14.0

type Validations struct {
	// contains filtered or unexported fields
}

Validations represent a collection of config setting validations

func NewValidations added in v0.14.0

func NewValidations() *Validations

NewValidations creates and returns an instance of Validations

Jump to

Keyboard shortcuts

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