input

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbsProjectPath

type AbsProjectPath interface {
	// SetAbsProjectPath sets the project file location
	SetAbsProjectPath(string)
}

AbsProjectPath allows the absolute project path to be set on an object

type Config

type Config struct {
	// Repo is the go project package
	Repo string

	// AbsProjectPath is the absolute path to the project root, including the project directory.
	AbsProjectPath string

	// ProjectName is the operator's name, ex. app-operator
	ProjectName string
}

Config configures the execution scaffold templates

type File

type File interface {
	// GetInput returns the Input for creating a scaffold file
	GetInput() (Input, error)
}

File is a scaffoldable file

type IfExistsAction

type IfExistsAction int

IfExistsAction determines what to do if the scaffold file already exists

const (
	// Overwrite truncates and overwrites the existing file (default)
	Overwrite IfExistsAction = iota

	// Error returns an error and stops processing
	Error

	// Skip skips the file and moves to the next one
	Skip
)

type Input

type Input struct {
	// Path is the file to write
	Path string

	// IfExistsAction determines what to do if the file exists
	IfExistsAction IfExistsAction

	// IsExec indicates whether the file should be written with executable
	// permissions.
	// Defaults to false
	IsExec bool

	// TemplateBody is the template body to execute
	TemplateBody string

	// TemplateFuncs are any funcs used in the template. These funcs must be
	// registered before execution.
	TemplateFuncs template.FuncMap

	// Repo is the go project package
	Repo string

	// AbsProjectPath is the absolute path to the project root, including the project directory.
	AbsProjectPath string

	// ProjectName is the operator's name, ex. app-operator
	ProjectName string

	// Delims is a slice of two strings representing the left and right delimiter
	// defaults to {{ }}
	Delims [2]string
}

Input is the input for scaffoldig a file

func (*Input) SetAbsProjectPath

func (i *Input) SetAbsProjectPath(p string)

SetAbsProjectPath sets the absolute project path

func (*Input) SetProjectName

func (i *Input) SetProjectName(n string)

SetProjectName sets the project name

func (*Input) SetRepo

func (i *Input) SetRepo(r string)

SetRepo sets the repo

type ProjectName

type ProjectName interface {
	// SetProjectName sets the project name
	SetProjectName(string)
}

ProjectName allows the project name to be set on an object

type Repo

type Repo interface {
	// SetRepo sets the repo
	SetRepo(string)
}

Repo allows a repo to be set on an object

type Validate

type Validate interface {
	// Validate returns nil if the inputs' validation logic approves of
	// field values, the template, etc.
	Validate() error
}

Validate validates input

Jump to

Keyboard shortcuts

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