scaffoldrc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package scaffoldrc contains the runtime configuration for users

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthEntry

type AuthEntry struct {
	Match regexp.Regexp `yaml:"match"`
	Basic BasicAuth     `yaml:"basic"`
	Token string        `yaml:"token"`
}

type BasicAuth

type BasicAuth struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type RCValidationError

type RCValidationError struct {
	Key   string
	Cause error
}

type RcValidationErrors

type RcValidationErrors []RCValidationError

func (RcValidationErrors) Error

func (e RcValidationErrors) Error() string

type RunHooksOption

type RunHooksOption string
var (
	RunHooksNever  RunHooksOption = "never"
	RunHooksAlways RunHooksOption = "always"
	RunHooksPrompt RunHooksOption = "prompt"
)

func ParseRunHooksOption

func ParseRunHooksOption(s string) RunHooksOption

func (RunHooksOption) IsValid

func (r RunHooksOption) IsValid() bool

func (RunHooksOption) String

func (r RunHooksOption) String() string

func (*RunHooksOption) UnmarshalText

func (r *RunHooksOption) UnmarshalText(text []byte) error

type ScaffoldRC

type ScaffoldRC struct {
	// Settings define the settings for the scaffold application.
	Settings Settings `yaml:"settings"`

	// Defaults define a default value for a variable.
	//   name: myproject
	//   git_user: hay-kot
	//
	// These are injected into the template as variables for
	// every scaffold.
	Defaults map[string]any `yaml:"defaults"`

	// Aliases define a alias for a repository.
	// or filepath.
	//
	//   component: https://githublcom/hay-kot/scaffold-go-component
	//   cli: https://github.com/hay-kot/scaffold-go-cli
	Aliases map[string]string `yaml:"aliases"`

	// Shorts define a short name for a repository.
	// the key will be expanded into the value.
	//   gh: https://github.com
	//   gt: https://gitea.com
	//
	// This will allow you to use the short name in the scaffold
	//   gh:myorg/myrepo
	Shorts map[string]string `yaml:"shorts"`

	// Auth defines a list of auth entries that can be used to
	// authenticate with a remote SCM.
	Auth []AuthEntry `yaml:"auth"`
}

func Default

func Default() *ScaffoldRC

Default returns a default scaffold rc file.

func New

func New(r io.Reader) (*ScaffoldRC, error)

New reads a scaffold rc file from the reader and returns a ScaffoldRC struct.

func (*ScaffoldRC) Authenticator

func (rc *ScaffoldRC) Authenticator(pkgurl string) (transport.AuthMethod, bool)

func (*ScaffoldRC) Validate

func (rc *ScaffoldRC) Validate() error

type Settings

type Settings struct {
	Theme    styles.HuhTheme `yaml:"theme"`
	RunHooks RunHooksOption  `yaml:"run_hooks"`
}

Jump to

Keyboard shortcuts

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