templates

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitCommandsTpl = "initCommands"
	MainFileTpl     = "mainFile"
)

Variables

This section is empty.

Functions

func Execute

func Execute(templateName string, data any) ([]byte, error)

func ExecuteTemplate

func ExecuteTemplate(tpl *template.Template, data any) ([]byte, error)

func FlagTypeDefaultValue

func FlagTypeDefaultValue(flagType FlagType) string

Types

type Command

type Command struct {
	IsRoot        bool
	VarName       string
	ParentVarName string

	Use           string
	Example       string
	Short         string
	Long          string
	SilenceUsage  bool
	SilenceErrors bool

	Flags    []Flag
	Handlers []Handler
}

type Flag

type Flag struct {
	Type FlagType

	Name         string
	Shorthand    string
	DefaultValue string
	Description  string

	IsRequired   bool
	IsPersistent bool
}

type FlagType

type FlagType string
const (
	StringFlagType  FlagType = "String"
	BoolFlagType    FlagType = "Bool"
	IntFlagType     FlagType = "Int"
	Int8FlagType    FlagType = "Int8"
	Int16FlagType   FlagType = "Int16"
	Int32FlagType   FlagType = "Int32"
	Int64FlagType   FlagType = "Int64"
	UintFlagType    FlagType = "Uint"
	Uint8FlagType   FlagType = "Uint8"
	Uint16FlagType  FlagType = "Uint16"
	Uint32FlagType  FlagType = "Uint32"
	Uint64FlagType  FlagType = "Uint64"
	Float32FlagType FlagType = "Float32"
	Float64FlagType FlagType = "Float64"
)

func FlagTypeByASTPrimitive

func FlagTypeByASTPrimitive(astType string) FlagType

type Handler

type Handler struct {
	MethodName           string
	ExecutorPackageAlias string
	ExecutorTypeName     string

	IsPreRun        bool
	IsPostRun       bool
	IsPersistentRun bool

	HasReturn bool
}

type Import

type Import struct {
	Alias   string
	Package string
}

type InitCommands

type InitCommands struct {
	BuildTag string
	Imports  []Import
	Commands []Command
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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