config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides tools for loading conch.yml configuration files.

Index

Constants

View Source
const StandardFilename = "conch.yml"

Variables

View Source
var ErrLocation = errors.New("location must be a valid directory")
View Source
var ErrVersion = errors.New("only version 1 is supported")

Functions

func Discover

func Discover(dirname string) (string, error)

Discover looks for a configuration file in the specified directory, and returns the path to it. If the file does not exist, it returns an empty string. If the directory does not exist, it returns an error.

Types

type Config

type Config struct {
	Version int
	Policy
	Exclude
}

func Default

func Default() *Config

Default returns the default configuration, which is used when the repository does not include its own configuration file.

func Load

func Load(file io.Reader) (*Config, error)

Load unmarshals a yaml file to a Config object.

func Open

func Open(filename string) (*Config, error)

Open tries to get a Config from a file name or path. If the name is empty, it returns the default configuration. If the name is invalid, it returns an error.

type Description

type Description struct {
	MinLength int `yaml:"minLength"`
	MaxLength int `yaml:"maxLength"`
}

type Exclude

type Exclude struct {
	Prefixes util.CaseInsensitiveSet
}
type Footer struct {
	RequiredTokens util.CaseInsensitiveSet `yaml:"requiredTokens"`
	Tokens         util.CaseInsensitiveSet
}

type Policy

type Policy struct {
	Type
	Scope
	Description
	Footer
}

type Scope

type Scope struct {
	Required bool
	Scopes   util.CaseInsensitiveSet
}

type Type

type Type struct {
	Types util.CaseInsensitiveSet
	Minor util.CaseInsensitiveSet
	Patch util.CaseInsensitiveSet
}

Jump to

Keyboard shortcuts

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