templates

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SkeletonConfig = `log:
  level: info
`
View Source
const SkeletonGoMod = `` /* 176-byte string literal not displayed */

Variables

This section is empty.

Functions

func CommandExecution

func CommandExecution(data CommandData) string

func CommandInitializer

func CommandInitializer(data CommandData) *jen.File

func CommandRegistration

func CommandRegistration(data CommandData) *jen.File

func SkeletonInternalVersion

func SkeletonInternalVersion(modulePath string) *jen.File

SkeletonInternalVersion generates the internal/version/version.go file for scaffolded projects, mirroring gtb's own internal/version pattern.

func SkeletonMain

func SkeletonMain(modulePath string) *jen.File

SkeletonMain generates the cmd/<name>/main.go for scaffolded projects. It uses the internal/version package to retrieve version info and passes it to the root command constructor.

func SkeletonRoot

func SkeletonRoot(data SkeletonRootData) *jen.File

Types

type CommandData

type CommandData struct {
	Package                  string
	PascalName               string
	Name                     string
	Aliases                  []string
	Args                     string
	Short                    string
	Long                     string
	Hidden                   bool
	WithAssets               bool
	Flags                    []CommandFlag
	PersistentFlags          []CommandFlag
	AncestralPersistentFlags []CommandFlag
	MutuallyExclusive        [][]string
	RequiredTogether         [][]string
	Logic                    string
	Imports                  []string
	FullFileContent          string
	TestCode                 string
	Recommendations          []string
	PersistentPreRun         bool
	PreRun                   bool
	HasSubcommands           bool
	OmitRun                  bool
	WithInitializer          bool
	Hashes                   map[string]string
}

type CommandFlag

type CommandFlag struct {
	Name          string
	Type          string
	Description   string
	Persistent    bool
	Shorthand     string
	Default       string
	DefaultIsCode bool
	Required      bool
	Hidden        bool
}

type SkeletonRootData

type SkeletonRootData struct {
	Name             string
	Description      string
	ReleaseProvider  string
	Host             string
	Org              string
	RepoName         string
	Private          bool
	DisabledFeatures []string
	EnabledFeatures  []string
	HelpType         string // "slack", "teams", or ""
	SlackChannel     string
	SlackTeam        string
	TeamsChannel     string
	TeamsTeam        string
	Subcommands      []SkeletonSubcommand
}

type SkeletonSubcommand added in v1.0.7

type SkeletonSubcommand struct {
	ImportPath  string // e.g. "github.com/org/repo/pkg/cmd/serve"
	PkgAlias    string // e.g. "serve"
	Constructor string // e.g. "NewCmdServe"
}

SkeletonSubcommand describes a top-level command that must be registered in the generated NewCmdRoot function.

Jump to

Keyboard shortcuts

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