config

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHooks

func AddHooks(loadHooks func(profile string) Hooks, command *cobra.Command) *cobra.Command

AddHooks will add before and after hooks to the given command.

func AddProfile

func AddProfile(profile string) error

func AvailableProfiles

func AvailableProfiles() []string

func CurrentProfile

func CurrentProfile() string

func Dir

func Dir() string

func ExpandFilePath

func ExpandFilePath(path string) string

ExpandFilePath does bash-esque expansions on a filepath

func GetDefaultConfigDir

func GetDefaultConfigDir() string

GetDefaultConfigDir will return the default location to store profiles which is $XDG_CONFIG_HOME/dfm or $HOME/.config/dfm

func GetProfileByName

func GetProfileByName(name string) string

func Init

func Init()

func ModuleDir

func ModuleDir() string

ModuleDir will return the module directory for the given profile

func ProfileDir

func ProfileDir() string

ProfileDir will return the config.Dir joined with profiles.

func ProfileName

func ProfileName(path string) string

ProfileName returns the name of the profile from it's full path

func RunCommands

func RunCommands(commands []string)

RunCommands will run the given slice of strings each as their own command

func SetCurrentProfile

func SetCurrentProfile(profile string) error

SetCurrentProfile will save the config.json

func XDG

func XDG() string

XDG returns the appropriate XDG_CONFIG_HOME directory

Types

type Config

type Config struct {
	// CurrentProfileName is the currently loaded profile.
	CurrentProfileName string `yaml:"current_profile"`
}

type DFMYml

type DFMYml struct {
	Hooks       Hooks            `yaml:"hooks"`
	Mappings    filemap.Mappings `yaml:"mappings"`
	Modules     []Module         `yaml:"modules"`
	SyncModules bool             `yaml:"always_sync_modules"`
}

DFMYml is used for extending and configuring DFM. It is the .dfm.yml file found in the root of a profile.

func LoadDotDFM

func LoadDotDFM(profileDir string) DFMYml

LoadDotDFM will load the hooks file for the given Profile

func (DFMYml) PostLinkModules

func (yml DFMYml) PostLinkModules() []Module

Return modules which should be linked before the parent profile

func (DFMYml) PreLinkModules

func (yml DFMYml) PreLinkModules() []Module

Return modules which should be linked before the parent profile

func (DFMYml) Validate

func (yml DFMYml) Validate()

type Hooks

type Hooks map[string][]string

Hooks is a map of "hook_name" to a slice of string shell commands to run

type Module

type Module struct {
	Repo         string           `yaml:"repo"`
	Branch       string           `yaml:"branch,omitempty"`
	Link         string           `yaml:"link,omitempty"`
	UserName     string           `yaml"name"`
	UserLocation string           `yaml:"location,omitempty"`
	Mappings     filemap.Mappings `yaml:"mappings,omitempty"`
	PullOnly     bool             `yaml:"pull_only"`
}

Module is a profile module, it will be linked as it if was a top level profile.

func (Module) Location

func (m Module) Location() string

func (Module) Name

func (m Module) Name() string

Name of the module, based on what git would use as the directory name from the URL. A specific name can be specified in the module configuration

Jump to

Keyboard shortcuts

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