config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	PathTemplateConf string     `yaml:"-" validate:"required,file"`
	PathUserConf     string     `yaml:"-" validate:"required,file"` // Path to configuration file
	Stderr           io.Writer  `yaml:"-" validate:"required"`
	RepoURLs         []string   `yaml:"repos,omitempty"` // URLs to repo git repositories
	Templates        []Template `yaml:"-"`               // Template definitions
}

File configuration as loaded from the configuration file

func (*File) AppendTemplate

func (f *File) AppendTemplate(t Template) (err error)

AppendTemplate appends a template to list of templates. If stop is non zero, the calling function should exit the program with the value contained in stop.

func (*File) Load

func (f *File) Load() error

Load loads configuration file from disk

func (*File) SaveTemplates

func (f *File) SaveTemplates() error

SaveTemplates saves template configuration file to disk

type FileIface

type FileIface interface {
	// AppendTemplate appends a template to list of templates.
	// If stop is non zero, the calling function should exit the program with the
	// value contained in stop.
	AppendTemplate(t Template) (err error)
	// Load loads configuration file from disk
	Load() error
	// SaveTemplates saves template configuration file to disk
	SaveTemplates() error
}

FileIface ...

type SortByName

type SortByName []Template

SortByName sort template alphabetically by name

func (SortByName) Len

func (a SortByName) Len() int

func (SortByName) Less

func (a SortByName) Less(i, j int) bool

func (SortByName) Swap

func (a SortByName) Swap(i, j int)

type Template

type Template struct {
	Handle   string `yaml:"handle"`
	Template string `yaml:"template"`
	Origin   string `yaml:"origin"`
	URL      string `yaml:"url"`
	Desc     string `yaml:"desc"`
}

Template template configuration in main configuration file

Jump to

Keyboard shortcuts

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