config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParameterBase64 = "base64"

	Base64EncRawStd  = "raw_std"
	Base64EncRawURL  = "raw_url"
	Base64EncStd     = "std"
	Base64EncURL     = "url"
	Base64EncDefault = Base64EncStd
)
View Source
const ParameterDatetime = "datetime"
View Source
const ParameterDirectory = "directory"
View Source
const ParameterEmail = "email"
View Source
const ParameterEnum = "enum"
View Source
const ParameterFile = "file"
View Source
const ParameterFloat = "float"
View Source
const ParameterGit = "git"
View Source
const ParameterHex = "hex"
View Source
const ParameterHostname = "hosthame"
View Source
const ParameterIP = "ip"
View Source
const ParameterInteger = "integer"
View Source
const ParameterJSON = "json"
View Source
const ParameterMac = "mac"
View Source
const ParameterSemver = "semver"
View Source
const ParameterString = "string"
View Source
const ParameterURL = "url"
View Source
const ParameterUUID = "uuid"
View Source
const ParameterXML = "xml"

Variables

View Source
var ErrGitIncorrectRefType = errors.New("value does not conform an expected reference type")

Functions

func NormalizeName

func NormalizeName(name string) string

Types

type Config

type Config struct {
	Description string
	Git         git.AccessMode
	Network     bool
	Parameters  map[string]Parameter
	Flags       map[string]Flag
}

func Parse

func Parse(reader io.Reader) (Config, error)

type Flag

type Flag interface {
	Required() bool
	Description() string
	String() string
}

func NewFlag

func NewFlag(description string, required bool) Flag

type Parameter

type Parameter interface {
	Specification() map[string]string
	Description() string
	Type() string
	Required() bool
	Validate(context.Context, string) error
}

func NewBase64

func NewBase64(description string, required bool, spec map[string]string) (Parameter, error)

func NewDatetime

func NewDatetime(description string, required bool, spec map[string]string) (Parameter, error)

func NewDirectory

func NewDirectory(description string, required bool, spec map[string]string) (Parameter, error)

func NewEmail

func NewEmail(description string, required bool, spec map[string]string) (Parameter, error)

func NewEnum

func NewEnum(description string, required bool, spec map[string]string) (Parameter, error)

func NewFile

func NewFile(description string, required bool, spec map[string]string) (Parameter, error)

func NewFloat

func NewFloat(description string, required bool, spec map[string]string) (Parameter, error)

func NewGit

func NewGit(
	description string,
	required bool,
	spec map[string]string,
	createRepo func() (*git.Repo, error),
) (Parameter, error)

func NewHex

func NewHex(description string, required bool, spec map[string]string) (Parameter, error)

func NewHostname

func NewHostname(description string, required bool, spec map[string]string) (Parameter, error)

func NewIP

func NewIP(description string, required bool, spec map[string]string) (Parameter, error)

func NewInteger

func NewInteger(description string, required bool, spec map[string]string) (Parameter, error)

func NewJSON

func NewJSON(description string, required bool, spec map[string]string) (Parameter, error)

func NewMac

func NewMac(description string, required bool, spec map[string]string) (Parameter, error)

func NewSemver

func NewSemver(description string, required bool, spec map[string]string) (Parameter, error)

func NewString

func NewString(description string, required bool, spec map[string]string) (Parameter, error)

func NewURL

func NewURL(description string, required bool, spec map[string]string) (Parameter, error)

func NewUUID

func NewUUID(description string, required bool, spec map[string]string) (Parameter, error)

func NewXML

func NewXML(description string, required bool, spec map[string]string) (Parameter, error)

type RawConfig

type RawConfig struct {
	Description string                  `toml:"description"`
	Git         string                  `toml:"git"`
	Network     bool                    `toml:"network"`
	Parameters  map[string]RawParameter `toml:"parameters"`
	Flags       map[string]RawFlag      `toml:"flags"`
}

type RawFlag

type RawFlag struct {
	Required    bool   `toml:"required"`
	Description string `toml:"description"`
}

type RawParameter

type RawParameter struct {
	Type        string            `toml:"type"`
	Required    bool              `toml:"required"`
	Description string            `toml:"description"`
	Spec        map[string]string `toml:"spec"`
}

Jump to

Keyboard shortcuts

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