Help us shape the future of Go! Take the 2026 Go Developer Survey

options

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(flagSet *pflag.FlagSet) error

func InitYAML

func InitYAML() error

Types

type Alias

type Alias struct {
	Type AliasType `mapstructure:"type"`
	Name string    `mapstructure:"name"`

	// Literal
	Flags map[string][]string `mapstructure:"flags,omitempty"`

	// FilePattern
	Paths    []string `mapstructure:"paths,omitempty"`
	Patterns []string `mapstructure:"patterns,omitempty"`

	// Command
	Command *string `mapstructure:"command,omitempty"`
	Timeout *int64  `mapstructure:"timeout,omitempty"`
}

Alias is a catch-all type for alias configurations

func (*Alias) IsValid

func (a *Alias) IsValid() error

type AliasType

type AliasType string
const (
	Literal AliasType = "literal"

	CamelCase      AliasType = "camelcase"
	PascalCase     AliasType = "pascalcase"
	SnakeCase      AliasType = "snakecase"
	UpperSnakeCase AliasType = "uppersnakecase"
	KebabCase      AliasType = "kebabcase"
	DotCase        AliasType = "dotcase"

	FilePattern AliasType = "filepattern"

	Command AliasType = "command"
)

func (AliasType) Canonical

func (a AliasType) Canonical() AliasType

func (AliasType) IsValid

func (a AliasType) IsValid() error

func (AliasType) String

func (a AliasType) String() string

type Delimiters

type Delimiters struct {
	// If set to `true`, the default delimiters (single-quote, double-qoute, and backtick) will not be used unless provided as `additional` delimiters
	DisableDefaults bool     `mapstructure:"disableDefaults"`
	Additional      []string `mapstructure:"additional"`
}

type Options

type Options struct {
	AccessToken         string `mapstructure:"accessToken"`
	BaseUri             string `mapstructure:"baseUri"`
	Branch              string `mapstructure:"branch"`
	CommitUrlTemplate   string `mapstructure:"commitUrlTemplate"`
	DefaultBranch       string `mapstructure:"defaultBranch"`
	Dir                 string `mapstructure:"dir" yaml:"-"`
	HunkUrlTemplate     string `mapstructure:"hunkUrlTemplate"`
	OutDir              string `mapstructure:"outDir"`
	ProjKey             string `mapstructure:"projkey"`
	RepoName            string `mapstructure:"repoName"`
	RepoType            string `mapstructure:"repoType"`
	RepoUrl             string `mapstructure:"repoUrl"`
	Revision            string `mapstructure:"revision"`
	UserAgent           string `mapstructure:"userAgent"`
	ContextLines        int    `mapstructure:"contextLines"`
	Lookback            int    `mapstructure:"lookback"`
	UpdateSequenceId    int    `mapstructure:"updateSequenceId"`
	AllowTags           bool   `mapstructure:"allowTags"`
	Debug               bool   `mapstructure:"debug"`
	DryRun              bool   `mapstructure:"dryRun"`
	IgnoreServiceErrors bool   `mapstructure:"ignoreServiceErrors"`
	Prune               bool   `mapstructure:"prune"`

	Aliases    []Alias    `mapstructure:"aliases"`
	Delimiters Delimiters `mapstructure:"delimiters"`
	Projects   []Project  `mapstructure:"projects"`
}

func GetOptions

func GetOptions() (Options, error)

func GetWrapperOptions

func GetWrapperOptions(dir string, merge func(Options) (Options, error)) (Options, error)

func (Options) GetProjectKeys

func (o Options) GetProjectKeys() (projects []string)

func (Options) Validate

func (o Options) Validate() error

Validate ensures all options have been set to a valid value

func (Options) ValidateRequired

func (o Options) ValidateRequired() error

type Project

type Project struct {
	Key     string  `mapstructure:"key"`
	Dir     string  `mapstructure:"dir"`
	Aliases []Alias `mapstructure:"aliases"`
}

type RepoType

type RepoType string
const (
	GITHUB    RepoType = "github"
	GITLAB    RepoType = "gitlab"
	BITBUCKET RepoType = "bitbucket"
	CUSTOM    RepoType = "custom"
)

Jump to

Keyboard shortcuts

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