config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// absolute path to the used configuration file
	ConfigFile string `yaml:"-"`
	// absolute path to the affected git repository
	GitDir string `yaml:"-"`
	// working directory for hook executions which defaults to the root of the repository
	WorkingDir string `yaml:"-"`
	// absolute path to the giks binary file
	Binary string `yaml:"-"`
	// parsed hook configurations based on the configuration file
	Hooks map[string]Hook `yaml:"hooks"`
	// version of the configuration in case backwards compatibility is not an option at some point
	Version float32 `yaml:"version"`
}

Config holds the config information provided by the used configuration file and additional meta information which is available at runtime.

func AssembleConfig

func AssembleConfig(ga args.GiksArgs) Config

AssembleConfig takes giks specific arguments and parses the configuration file for giks in order to return a config. Additionally, it sanitizes the given inputs targeting files and returns a configuration which can be used without bothering about paths.

func (Config) Hook

func (c Config) Hook(name string) Hook

func (Config) HookList

func (c Config) HookList(all bool) map[string]Hook

func (Config) HookListNames

func (c Config) HookListNames(all bool) []string

func (Config) LookupHook

func (c Config) LookupHook(name string) (*Hook, error)

type Hook

type Hook struct {
	Enabled bool   `yaml:"enabled"`
	Steps   []Step `yaml:"steps"`
	Name    string `yaml:"-"`
}

func (Hook) ToMap

func (h Hook) ToMap() map[string]interface{}

type PluginStep

type PluginStep struct {
	Name           string            `yaml:"name"`
	SuccessMessage string            `yaml:"success_message"`
	ErrorMessage   string            `yaml:"error_message"`
	Vars           map[string]string `yaml:"vars"`
}

func (PluginStep) Validate

func (ps PluginStep) Validate() error

type Step

type Step struct {
	Command string     `yaml:"command"`
	Exec    string     `yaml:"exec"`
	Script  string     `yaml:"script"`
	Plugin  PluginStep `yaml:"plugin"`
}

func (Step) ToMap

func (s Step) ToMap() map[string]interface{}

Jump to

Keyboard shortcuts

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