generator

package
v0.0.0-...-5af6bcd Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusAppBuilding       int = iota // Start to build an app, should given the appname and version
	StatusComponentBuilding            // Start to build a component in the app.
	StatusFileBuilding                 // Start to build a file in app layer or component layer
	StatusFileBuilded                  // File builded, to start a new session or return parent
	StatusComponentBuilded             // Component builded, to start a new component session
	StatusAppBuilded                   // App builded, to start the content generating.
	StatusAppGenerateFailed            // App content writing, incase failure.
	StatusAppGenerated                 // Generated, next to finished or modify
)
View Source
const NamePatternString = "[a-zA-Z][a-z0-9A-Z-]{0,62}[a-z0-9A-Z]"

Variables

View Source
var Operations = []Operation{Create, Modify, Remove, General}

Functions

func BuildInlineOptions

func BuildInlineOptions[T any](ojbs []T) string

func BuildInlineOptionsWithModifier

func BuildInlineOptionsWithModifier[T any](ojbs []T, fun func(T) string) string

func BuildOptions

func BuildOptions[T any](ojbs []T) string

func BuildOptionsWithModifier

func BuildOptionsWithModifier[T any](ojbs []T, fun func(T) string) string

func ChooseIndex

func ChooseIndex(scanner *bufio.Scanner, typ string, holders []OperationHolder) int

func ChooseType

func ChooseType[T any](scanner *bufio.Scanner, opts []T) T

func IsValidName

func IsValidName(val string) bool

func ParseOptions

func ParseOptions[T any](input string, options []T) (int, error)

func SigForOperation

func SigForOperation(op Operation) string

Types

type AppBuilder

type AppBuilder interface {
	Build() *manifest.AppManifests
}

Build AppManifests from model.

type GeneralCommand

type GeneralCommand string
const (
	OP_NOOP     GeneralCommand = "noop"
	OP_Finish   GeneralCommand = "finished"
	OP_Cancel   GeneralCommand = "cancel"
	OP_Generate GeneralCommand = "generate"
)

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(logger log.Logger) *Generator

func (*Generator) Generate

func (g *Generator) Generate(name, version string, manifest *manifest.AppManifests, path string) error

type NextOperation

type NextOperation interface {
	NextOperation(scanner *bufio.Scanner) []Operation
	// 列出可选类型,并选择
	Create(scanner *bufio.Scanner) OperationHolder
	Modify(scanner *bufio.Scanner) OperationHolder
	Remove(scanner *bufio.Scanner)
	General(scanner *bufio.Scanner) GeneralCommand
}

type Operation

type Operation int
const (
	Create Operation = iota
	Modify
	Remove
	General
)

func ChooseOperation

func ChooseOperation(scanner *bufio.Scanner) Operation

列出可选类型,并选择

type OperationHolder

type OperationHolder interface {
	Type() string

	Args() []string
	ArgsExample() string
	ParseArgs(input string) error
	String() string
}

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any]() *Stack[T]

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() (result T)

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (result T)

func (*Stack[T]) Push

func (s *Stack[T]) Push(value T)

func (*Stack[T]) Size

func (s *Stack[T]) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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