Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyDefault(input dsl.Input, ctx dsl.Context) (string, error)
- func BuildContext(inputs []dsl.Input, answers map[string]string) (dsl.Context, error)
- func Run(templates []*template.Template, eng *engine.Engine) error
- func RunApp(templates []*tmpl.Template, eng *engine.Engine) error
- func RunInputs(inputs []dsl.Input) (dsl.Context, error)
- func RunInputsWithInitial(inputs []dsl.Input, initial dsl.Context) (dsl.Context, error)
- func RunMenu() (menuAction, error)
- func RunProgress(req *template.ScaffoldRequest, eng *engine.Engine) (*template.ScaffoldResult, error)
- func RunSelector(templates []*template.Template) (*template.Template, error)
- func ShouldAskInput(input dsl.Input, ctx dsl.Context) (bool, error)
- func ShowSummary(result *template.ScaffoldResult, req *template.ScaffoldRequest)
- func ValidateInputValue(input dsl.Input, value string) error
- func WelcomeView(width int) string
- type App
- type ConfigModel
- type GitHubModel
- type MenuAction
- type MenuModel
- type RootModel
- type TemplatesModel
Constants ¶
const ( ActionNew = actionNew ActionTemplates = actionTemplates ActionGitHub = actionGitHub ActionConfig = actionConfig )
Variables ¶
var ErrMenuExit = errors.New("menu exited")
Functions ¶
func ApplyDefault ¶
ApplyDefault returns the input's default value as a string. If the default is a string containing `{{ }}` interpolations, it will be interpolated.
func BuildContext ¶
BuildContext constructs a dsl.Context from inputs + an answers map. It evaluates each input `when:` in order, applies defaults when answers are missing, and applies `when: false` defaults regardless of provided answers.
func RunInputsWithInitial ¶
RunInputsWithInitial is like RunInputs but seeds the context with pre-filled values. This is used by the `structify new` command to support a mixed mode (flags + TUI).
func RunProgress ¶
func RunProgress(req *template.ScaffoldRequest, eng *engine.Engine) (*template.ScaffoldResult, error)
RunProgress executes scaffolding while rendering a progress TUI.
func RunSelector ¶
RunSelector shows a searchable list of templates and returns the selected one.
Edge cases: - if templates is empty => returns an actionable error - if only one template => returns it without launching TUI
func ShouldAskInput ¶
ShouldAskInput decides whether a given input should be prompted, based on its `when:` expression and the accumulated context.
func ShowSummary ¶
func ShowSummary(result *template.ScaffoldResult, req *template.ScaffoldRequest)
ShowSummary prints a final summary after successful generation.
func ValidateInputValue ¶
ValidateInputValue validates a user-provided (string) value against the input definition. This includes `validate` regex when present.
func WelcomeView ¶ added in v0.1.4
Types ¶
type App ¶ added in v0.1.2
type App struct {
// contains filtered or unexported fields
}
func (*App) Done ¶ added in v0.1.5
Done retorna true cuando el usuario presionó cualquier tecla en stateDone/stateError. Se usa por RootModel para volver al menú sin salir del programa.
func (*App) ViewContent ¶ added in v0.1.6
ViewContent returns the raw (non-centered) content of this screen. RootModel is responsible for centering.
type ConfigModel ¶ added in v0.1.5
type ConfigModel struct {
// contains filtered or unexported fields
}
func NewConfigModel ¶ added in v0.1.5
func NewConfigModel(templates []*template.Template) *ConfigModel
func (*ConfigModel) Init ¶ added in v0.1.5
func (m *ConfigModel) Init() tea.Cmd
func (*ConfigModel) View ¶ added in v0.1.5
func (m *ConfigModel) View() string
func (*ConfigModel) ViewContent ¶ added in v0.1.6
func (m *ConfigModel) ViewContent() string
type GitHubModel ¶ added in v0.1.5
type GitHubModel struct {
// contains filtered or unexported fields
}
func NewGitHubModel ¶ added in v0.1.5
func NewGitHubModel() *GitHubModel
func (*GitHubModel) Init ¶ added in v0.1.5
func (m *GitHubModel) Init() tea.Cmd
func (*GitHubModel) View ¶ added in v0.1.5
func (m *GitHubModel) View() string
func (*GitHubModel) ViewContent ¶ added in v0.1.6
func (m *GitHubModel) ViewContent() string
type MenuAction ¶ added in v0.1.4
type MenuAction = menuAction
type MenuModel ¶ added in v0.1.4
type MenuModel struct {
// contains filtered or unexported fields
}
func NewMenuModel ¶ added in v0.1.4
func NewMenuModel() MenuModel
func (MenuModel) SelectedAction ¶ added in v0.1.4
func (m MenuModel) SelectedAction() menuAction
func (MenuModel) ViewContent ¶ added in v0.1.6
ViewContent returns the raw (non-centered) content of this screen. RootModel is responsible for applying any centering/alignment.
type RootModel ¶ added in v0.1.5
type RootModel struct {
// contains filtered or unexported fields
}
func NewRootModel ¶ added in v0.1.5
type TemplatesModel ¶ added in v0.1.5
type TemplatesModel struct {
// contains filtered or unexported fields
}
func NewTemplatesModel ¶ added in v0.1.5
func NewTemplatesModel(all []*template.Template) *TemplatesModel
func (*TemplatesModel) Init ¶ added in v0.1.5
func (m *TemplatesModel) Init() tea.Cmd
func (*TemplatesModel) View ¶ added in v0.1.5
func (m *TemplatesModel) View() string
func (*TemplatesModel) ViewContent ¶ added in v0.1.6
func (m *TemplatesModel) ViewContent() string
ViewContent returns the raw (non-centered) content of this screen. RootModel is responsible for applying any alignment/centering.