app

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodLink = "link"
	MethodCopy = "copy"
)
View Source
const Name string = "donut"

Variables

View Source
var UserHomeDir string

Functions

func DefaultConfigDirs

func DefaultConfigDirs() []string

func DefaultConfigFile

func DefaultConfigFile() string

func DefaultSourceDir

func DefaultSourceDir() string

func GetConfig

func GetConfig() *viper.Viper

func InitConfig

func InitConfig(cfgPath string) error

func NewConfig

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

func SetUserHomeDir

func SetUserHomeDir(dir string) func()

func WriteConfig

func WriteConfig(filename string) error

Types

type Config

type Config struct {
	SrcDir   string            `mapstructure:"src_dir"`
	DestDir  string            `mapstructure:"dest_dir"`
	Excludes []string          `mapstructure:"excludes"`
	Method   Method            `mapstructure:"method"`
	Mappings map[string]string `mapstructure:"mappings"`
}

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(file string) ConfigOption

func WithNameAndPath

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

type Donut

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

func New

func New(opts ...Option) (*Donut, error)

func (*Donut) Apply

func (d *Donut) Apply(force bool) error

func (*Donut) Init

func (d *Donut) Init(srcDir, cfgPath string) (err error)

func (*Donut) List

func (d *Donut) List() error

func (*Donut) Where

func (d *Donut) Where() error

type Method

type Method string

type Option

type Option func(*Donut) error

func WithConfig

func WithConfig(v *viper.Viper) Option

func WithErr

func WithErr(r io.Writer) Option

func WithOut

func WithOut(r io.Writer) Option

Jump to

Keyboard shortcuts

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