Documentation ¶
Index ¶
- Variables
- func FindConfig(path, dirname string) string
- func IsExist(err error) bool
- func IsNotExist(err error) bool
- func IsSkip(err error) bool
- type Block
- type Config
- type Copy
- type DiffError
- type Dir
- type Env
- type Hook
- type Line
- type Link
- type OpError
- type Pkg
- type Role
- func (r *Role) GetConfigFile() string
- func (r *Role) Init() error
- func (r *Role) Load() error
- func (r *Role) Ok() bool
- func (r *Role) Parse(target string) error
- func (r *Role) ParseBlocks(target string) error
- func (r *Role) ParseDirs(target string) error
- func (r *Role) ParseEnv() error
- func (r *Role) ParseFiles(target string) error
- func (r *Role) ParseHooks(target string) error
- func (r *Role) ParseLines(target string) error
- func (r *Role) ParseLinks(target string) error
- func (r *Role) ParseTpls(target string) error
- func (r *Role) ParseVars() error
- func (r *Role) SetConfigFile(name string) *Role
- func (r *Role) ShouldRun() bool
- func (r *Role) Status() error
- func (r *Role) StatusBlocks() error
- func (r *Role) StatusDirs() error
- func (r *Role) StatusFiles() error
- func (r *Role) StatusHooks() error
- func (r *Role) StatusLines() error
- func (r *Role) StatusLinks() error
- func (r *Role) StatusPkgs() error
- func (r *Role) StatusTpls() error
- func (r *Role) String() (s string)
- func (r *Role) Sync() (string, error)
- type RoleConfig
- type Task
- type Tasker
- type Tpl
- type Vars
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DecodeErrorUnused mapstructure decode option DecodeErrorUnused = true // TODO false if opts.Force // DecodeWeaklyTypedInput mapstructure decode option DecodeWeaklyTypedInput = true // Stdout writer Stdout io.Writer = os.Stdout // Stderr writer Stderr io.Writer = os.Stderr // Stdin reader Stdin io.Reader = os.Stdin )
View Source
var ( // ErrExist used when task is installed ErrExist = errors.New("already exists") // ErrNotExist ... ErrNotExist = errors.New("does not exists") // ErrFileExist ... ErrFileExist = errors.New("file exists") // ErrLinkExist ... ErrLinkExist = errors.New("link exists") // ErrNotEmpty ... ErrNotEmpty = errors.New("not empty") // ErrDirNotEmpty ... ErrDirNotEmpty = errors.New("directory not empty") // ErrSkip task ErrSkip = errors.New("skip") // ErrInvalid ... ErrInvalid = errors.New("invalid file") )
View Source
var ( // Action contains the running command name Action string )
Functions ¶
func FindConfig ¶
FindConfig searches a given file name or path relative to the home directory, or falls back to ~/.dot/config
Types ¶
type Block ¶
type Block struct { Task `mapstructure:",squash"` // Action, If, OS Target string // Target file Data string // Block content }
Block task
type Config ¶
type Config struct { Source string Target string Roles []*Role Platforms map[string][]*Role Git *url.URL // contains filtered or unexported fields }
Config struct
type Copy ¶
type Copy struct { Task `mapstructure:",squash"` // Action, If, OS Source string Target string Mode os.FileMode }
Copy task
type Hook ¶
type Hook struct { Task `mapstructure:",squash"` // Action, If, OS Command string Shell string Env *Env ExecDir string }
Hook command to execute FIXME: fmt.Println(t) -> stack exceeds limit
type Line ¶
type Line struct { Task `mapstructure:",squash"` // Action, If, OS Target string // Target file Data string // Line content }
Line task
type Pkg ¶
type Pkg struct { Task `mapstructure:",squash"` // Action, If, OS Name []string Args []string Manager string `mapstructure:"type"` }
Pkg task
type Role ¶
type Role struct { Name string Path string URL string // Git repository URL Git *url.URL // repo host and user Disabled bool `mapstructure:",omitempty"` OS []string Env *Env Vars *Vars IncludeVars []string Deps []string `mapstructure:"depends"` Pkgs []*Pkg `mapstructure:"pkg"` Dirs []*Dir `mapstructure:"dir"` Files []*Copy `mapstructure:"copy"` Links []*Link `mapstructure:"link"` Tpls []*Tpl `mapstructure:"template"` Lines []*Line `mapstructure:"line"` Blocks []*Block `mapstructure:"block"` Install []*Hook PostInstall []*Hook `mapstructure:"post_install"` Remove []*Hook PostRemove []*Hook `mapstructure:"post_remove"` // contains filtered or unexported fields }
Role struct
type RoleConfig ¶
type RoleConfig struct {
Role *Role // `mapstructure:",squash"`
}
RoleConfig struct
type Task ¶
type Task struct { Tasker // Action specifies a single action for which the task should be run Action string `mapstructure:",omitempty"` OS []string `mapstructure:",omitempty"` If []string `mapstructure:",omitempty"` }
Task struct
type Tasker ¶
type Tasker interface { String() string Init() error Status() error // Sync() error Do() error Undo() error // Already implemented CheckAction() error CheckOS() error CheckIf() error Check() error }
Tasker interface
type Tpl ¶
type Tpl struct { Task `mapstructure:",squash"` // Action, If, OS Source string Target string Ext string // Template extenstion (default: tpl) Env *Env // map[string]string Vars *Vars // map[string]interface{} IncludeVars []string `mapstructure:"include_vars"` // contains filtered or unexported fields }
Tpl task
Click to show internal directories.
Click to hide internal directories.