commands

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package commands contains Cobra command implementations with dependency injection.

Each command is implemented as a struct with injected dependencies, following the dependency injection pattern for testability:

type NewCommand struct {
    validator interfaces.Validator
    generator interfaces.ProjectGenerator
}

func NewNewCommand(v interfaces.Validator, g interfaces.ProjectGenerator) *NewCommand {
    return &NewCommand{validator: v, generator: g}
}

func (c *NewCommand) Command() *cobra.Command {
    // Returns configured cobra.Command
}

This pattern allows:

  • Easy mocking of dependencies in tests
  • Clear declaration of what each command needs
  • Compile-time verification of dependencies
  • Reusable command instances

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewCommand

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

Follows ADR-001 dependency injection pattern: command struct with injected dependencies.

func NewNewCommand

func NewNewCommand(validator interfaces.Validator, generator interfaces.ProjectGenerator, newRenderer RendererFactory, flushRenderer RendererFlusher) *NewCommand

Follows ADR-001: constructor accepts all dependencies as parameters.

func (*NewCommand) Command

func (c *NewCommand) Command() *cobra.Command

Command returns the cobra.Command for the 'new' subcommand.

type RendererFactory

type RendererFactory func(*cobra.Command) interfaces.Renderer

RendererFactory creates a renderer from a cobra command.

type RendererFlusher

type RendererFlusher func(*cobra.Command, interfaces.Renderer)

RendererFlusher flushes a renderer and handles errors.

type UIAddCommand added in v0.3.0

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

UIAddCommand represents the 'ui add' subcommand for adding templUI components.

func NewUIAddCommand added in v0.3.0

func NewUIAddCommand(
	detector interfaces.ProjectDetector,
	executor interfaces.UIExecutor,
	newRenderer RendererFactory,
	flushRenderer RendererFlusher,
) *UIAddCommand

NewUIAddCommand creates a new instance of the 'ui add' command with injected dependencies.

func (*UIAddCommand) Command added in v0.3.0

func (c *UIAddCommand) Command() *cobra.Command

Command returns the cobra.Command for the 'ui add' subcommand.

type UICommand added in v0.3.0

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

UICommand represents the 'ui' parent command for UI component management.

func NewUICommand added in v0.3.0

func NewUICommand(
	detector interfaces.ProjectDetector,
	executor interfaces.UIExecutor,
	newRenderer RendererFactory,
	flushRenderer RendererFlusher,
) *UICommand

NewUICommand creates a new instance of the 'ui' command with injected dependencies.

func (*UICommand) Command added in v0.3.0

func (c *UICommand) Command() *cobra.Command

Command returns the cobra.Command for the 'ui' subcommand.

type UIListCommand added in v0.3.0

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

UIListCommand represents the 'ui list' subcommand for listing templUI components.

func NewUIListCommand added in v0.3.0

func NewUIListCommand(
	detector interfaces.ProjectDetector,
	executor interfaces.UIExecutor,
	newRenderer RendererFactory,
	flushRenderer RendererFlusher,
) *UIListCommand

NewUIListCommand creates a new instance of the 'ui list' command with injected dependencies.

func (*UIListCommand) Command added in v0.3.0

func (c *UIListCommand) Command() *cobra.Command

Command returns the cobra.Command for the 'ui list' subcommand.

type UIUpgradeCommand added in v0.3.0

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

UIUpgradeCommand represents the 'ui upgrade' subcommand for updating templUI.

func NewUIUpgradeCommand added in v0.3.0

func NewUIUpgradeCommand(
	detector interfaces.ProjectDetector,
	executor interfaces.UIExecutor,
	newRenderer RendererFactory,
	flushRenderer RendererFlusher,
) *UIUpgradeCommand

NewUIUpgradeCommand creates a new instance of the 'ui upgrade' command with injected dependencies.

func (*UIUpgradeCommand) Command added in v0.3.0

func (c *UIUpgradeCommand) Command() *cobra.Command

Command returns the cobra.Command for the 'ui upgrade' subcommand.

type VersionCommand

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

VersionCommand represents the 'version' command for displaying version information.

func NewVersionCommand

func NewVersionCommand(build interfaces.BuildInfo, newRenderer RendererFactory, flushRenderer RendererFlusher) *VersionCommand

NewVersionCommand creates a new instance of the 'version' command with injected dependencies.

func (*VersionCommand) Command

func (c *VersionCommand) Command() *cobra.Command

Command returns the cobra.Command for the 'version' subcommand.

Jump to

Keyboard shortcuts

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