configs

package
v0.0.0-...-4a61b4d Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListConfigPaths

func ListConfigPaths(sourceDir string) []string

ListConfigPaths is used to list all possible config paths

func SaveConfigs

func SaveConfigs(path string, configs ...*Config) error

SaveConfigs is used to save configs into files

Types

type Config

type Config struct {
	Tag           string            `json:"tag" yaml:"tag"`
	Scopes        []string          `json:"scopes" yaml:"scopes"`
	Protoc        string            `json:"protoc" yaml:"protoc"`
	ProtocWorkDir string            `json:"protocWorkDir" yaml:"protocWorkDir"`
	Plugins       map[string]string `json:"plugins" yaml:"plugins"`
	Repositories  map[string]string `json:"repositories" yaml:"repositories"`
	Options       []string          `json:"options" yaml:"options"`
	ImportPaths   []string          `json:"importPaths" yaml:"importPaths"`
	PostActions   []*PostAction     `json:"postActions" yaml:"postActions"`
	PostShell     string            `json:"postShell" yaml:"postShell"`
}

Config defines the config model

func LoadConfigs

func LoadConfigs(path string) ([]*Config, error)

LoadConfigs is used to load config from specified path

type ConfigItem

type ConfigItem interface {
	// ID is used to return to config unique id
	ID() string
	// Path is used to return the config path
	Path() string
	// Config is used to return the Config
	Config() *Config
}

ConfigItem is the wrapper of Config

func GetConfigItems

func GetConfigItems(data []*Config, path string) []ConfigItem

GetConfigItems is used to generate ConfigItem from given config entity

func LoadConfigItems

func LoadConfigItems(path string) ([]ConfigItem, error)

LoadConfigItems is similar to LoadConfigs, but obtains the abstraction of the Config prototype structure

type PostAction

type PostAction struct {
	Name string   `json:"name" yaml:"name"`
	Args []string `json:"args" yaml:"args"`
}

PostAction defines the Action model

Jump to

Keyboard shortcuts

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