config

package
v0.0.0-...-260dfa6 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListCmd        = "list"
	ListInvalid    = 1
	ListWithType   = 2
	ListWithParent = 3
)
View Source
const (
	ConfigFile    = "related.json"
	DotConfigFile = ".related.json"
)

Variables

This section is empty.

Functions

func Availables

func Availables(kind string, parent string) map[string][]string

func GetFragment

func GetFragment[T Fragment](fragments []T, name string) T

func List

func List(args []string)

func Validate

func Validate(cfg Config) ([]string, []string)

Types

type Config

type Config struct {
	Types  []Type  `json:"types"`
	Groups []Group `json:"groups"`
}

func ReadConfigs

func ReadConfigs() Config

type Fragment

type Fragment interface {
	GetName() string
	GetPath() string
	GetSuffix() string
}

type Group

type Group struct {
	Name  string   `json:"name"`
	Pre   string   `json:"pre"`
	Post  string   `json:"post"`
	Types []string `json:"types"`
}

func (Group) GetName

func (g Group) GetName() string

func (Group) GetPath

func (g Group) GetPath() string

func (Group) GetSuffix

func (g Group) GetSuffix() string

type Type

type Type struct {
	Name     string `json:"name"`
	Path     string `json:"path"`
	Template string `json:"template"`
	Pre      string `json:"pre"`
	Post     string `json:"post"`
	Suffix   string `json:"suffix"`
}

func (Type) GetName

func (t Type) GetName() string

func (Type) GetPath

func (t Type) GetPath() string

func (Type) GetSuffix

func (t Type) GetSuffix() string

Jump to

Keyboard shortcuts

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