project

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

NewCommand constructs the Cobra command for generating a new project from the template.

func Run

func Run(opts Options) error

Run executes the project generation workflow based on options.

func RunWithWriter

func RunWithWriter(opts Options, out io.Writer) error

RunWithWriter 执行生成逻辑并将日志写入指定 writer。

Types

type EmbedTemplateGenerator

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

EmbedTemplateGenerator 基于嵌入文件的模板生成器

func NewEmbedTemplateGenerator

func NewEmbedTemplateGenerator(outputDir, modulePath, projectName string, opts ...Option) *EmbedTemplateGenerator

NewEmbedTemplateGenerator 创建新的嵌入模板生成器

func (*EmbedTemplateGenerator) Generate

func (g *EmbedTemplateGenerator) Generate() error

Generate 生成项目文件

type ModeResolver

type ModeResolver func(outputPath string) fs.FileMode

ModeResolver decides the output permission bits for generated files.

type Option

type Option func(*EmbedTemplateGenerator)

Option customizes the behaviour of the EmbedTemplateGenerator.

func WithFS

func WithFS(fsys fs.FS) Option

WithFS allows injecting a custom file system for template discovery (useful in tests).

func WithLogger

func WithLogger(logger func(string, ...interface{})) Option

WithLogger customises where progress output is written.

func WithModeResolver

func WithModeResolver(resolver ModeResolver) Option

WithModeResolver overrides how output permissions are decided.

type Options

type Options struct {
	ModulePath string
	OutputDir  string
	Name       string
	Force      bool
}

Options defines the CLI parameters for project generation.

Jump to

Keyboard shortcuts

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