cli

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(root *cobra.Command, cmd *cobra.Command)

AddCommand adds a subcommand to the root command with panic recovery

func ExecuteContext

func ExecuteContext(rootCmd *cobra.Command) error

ExecuteContext executes the root command with context

func NewRootCmd

func NewRootCmd(deps Dependencies) *cobra.Command

NewRootCmd creates the root command with dependency injection This follows the Command Factory pattern, avoiding global state

func RunMainMenu

func RunMainMenu() (string, error)

RunMainMenu shows the interactive main menu and returns the selected command name

func WithPanicRecovery

func WithPanicRecovery(fn func(*cobra.Command, []string) error) func(*cobra.Command, []string) error

WithPanicRecovery wraps a cobra RunE function with panic recovery This is the panic middleware mentioned in the requirements

Types

type Dependencies

type Dependencies struct {
	Config *config.Config
	Logger *slog.Logger
}

Dependencies holds all dependencies needed by CLI commands

Jump to

Keyboard shortcuts

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