linking

package
v5.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSymlinks(sourceDir, targetDir string, config Config, mappings filemap.Mappings) error

CreateSymlinks will read all of the files at sourceDir and link them to the appropriate location in targetDir, if there is a folder named config in sourceDir CreateSymlinks will run itself using that folder as sourceDir and targetDir as XDG_config.CONFIG_HOME or HOME/.config if XDG_config.CONFIG_HOME is not set.

Types

type Config

type Config struct {
	DryRun    bool
	Overwrite bool
}

Config changes the behavior of linking functions, it acts as a store for common functoin arguments

type LinkInfo

type LinkInfo struct {
	Src  string
	Dest string
}

LinkInfo holds the src and destination for our symlink.

func GenerateSymlink(sourceDir, targetDir string, file os.FileInfo) LinkInfo

GenerateSymlink will create a LinkInfo with the appropriate destination, handling the XDG_config.CONFIG_HOME special case.

func GenerateSymlinks(profileDir, target string, mappings filemap.Mappings) ([]LinkInfo, error)

GenerateSymlinks will create the symlinks so we know what they were supposed to be prior to removing the profile.

func (l *LinkInfo) Link(config Config) error

func (*LinkInfo) String

func (l *LinkInfo) String() string

type Linker

type Linker interface {
	Link(mappings filemap.Mappings, config Config) error
}

Jump to

Keyboard shortcuts

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