scaffold

package
v0.0.0-...-2b8a094 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenTemplate

func GenTemplate(path string, force bool) error

func GetTemplate

func GetTemplate(t template.Template) string

GetTemplate search template in config dir,ordered by: current dir > .template > ../.template > ~/.template > default

func WriteTemplate

func WriteTemplate(path string, force bool) error

WriteTemplate Write Template to dir ,so user can edit

Types

type File

type File struct {
	// Path specifies where the file will reside.
	Path string
	// Template is the template used to generate the file.
	Template string
}

File represents a file to generate.

type Generator

type Generator interface {
	Generate([]File) error
}

Generator is the interface that generates project template files.

Generate accepts a list of files and generates them based on their template.

func New

func New(opts ...Option) Generator

New returns a new generator struct.

type Option

type Option func(o *Options)

Option manipulates the Options passed.

func ContainerTag

func ContainerTag(r string) Option

func ContainerVersion

func ContainerVersion(r string) Option

func Directory

func Directory(d string) Option

Directory sets the directory in which files are generated.

func Mesh

func Mesh(r string) Option

func Namespace

func Namespace(r string) Option

func Port

func Port(r string) Option

func RegistryPrefix

func RegistryPrefix(r string) Option

func Replica

func Replica(r int) Option

func Service

func Service(s string) Option

Service sets the service name.

func Vendor

func Vendor(v string) Option

Vendor sets the service vendor.

type Options

type Options struct {
	// Service is the name of the service the generator will generate files
	// for.
	Service string
	// Vendor is the service vendor.
	Vendor string
	// Directory is the directory where the files will be generated to.
	Directory string

	//ContainerTag is the container's tag
	ContainerTag string

	// Version is the version of the container
	Version string

	// Port of your service
	Port string

	// Namespace in your k8s cluster
	Namespace string

	//RegistryPrefix eg: gcr.io/username/repo
	RegistryPrefix string

	//Mesh service mesh name eg:istio
	Mesh string

	//Replica number of ReplicaSet
	Replica int
}

Options represents the options for the generator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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