config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AppName string = "donut"

Variables

View Source
var UserHomeDir string

Functions

func DefaultConfigFile

func DefaultConfigFile() string

func DefaultStateDir

func DefaultStateDir() string

func ExpandEnvFunc

func ExpandEnvFunc() mapstructure.DecodeHookFunc

mapstructure's DecodeHookFunc that reads environment variables

func NewViper

func NewViper(opts ...ConfigOption) (*viper.Viper, error)

func SetUserHomeDir

func SetUserHomeDir(dir string) func()

Types

type Config

type Config struct {
	Source      string   `mapstructure:"source"`
	Destination string   `mapstructure:"destination"`
	Excludes    []string `mapstructure:"excludes"`
	Editor      []string `mapstructure:"editor"`
	Pager       []string `mapstructure:"pager"`
	Diff        []string `mapstructure:"diff"`
	Merge       []string `mapstructure:"merge"`
	Concurrency int
	File        string
}

func New

func New(opts ...ConfigOption) (*Config, error)

type ConfigOption

type ConfigOption func(v *viper.Viper) error

func WithData

func WithData(data map[string]interface{}) ConfigOption

func WithDefault

func WithDefault() ConfigOption

func WithFile

func WithFile(path string) ConfigOption

func WithNameAndPath

func WithNameAndPath(name string, paths ...string) ConfigOption

func WithPath

func WithPath(path string) []ConfigOption

Jump to

Keyboard shortcuts

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