cli

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDockerClient

func CreateDockerClient(cfg *manifest.Config) *dockercli.Client

CreateDockerClient creates a Docker client using config context and identifier.

func CreatePlanner

func CreatePlanner(docker *dockercli.Client, pr ui.Printer) *planner.Planner

CreatePlanner creates a planner with Docker client and printer configured.

func Execute

func Execute() int

Execute runs the root command and handles error formatting and exit codes.

func GetConfirmation

func GetConfirmation(cmd *cobra.Command, pr ui.Printer, opts ConfirmationOptions) (bool, error)

GetConfirmation handles user confirmation with TTY detection and appropriate prompting.

func GetDestroyConfirmation added in v0.2.0

func GetDestroyConfirmation(cmd *cobra.Command, pr ui.Printer, opts DestroyConfirmationOptions) (bool, error)

GetDestroyConfirmation handles user confirmation for destroy operations, requiring the user to type the identifier name.

func LoadConfigWithWarnings

func LoadConfigWithWarnings(cmd *cobra.Command, pr ui.Printer) (*manifest.Config, error)

LoadConfigWithWarnings loads the configuration from the --config flag and displays warnings.

func ProgressOperation

func ProgressOperation(pr ui.StdPrinter, message string, operation func(*ui.Progress) error) error

ProgressOperation runs an operation with a progress bar.

func RunWithRollingOrDirect added in v0.4.1

func RunWithRollingOrDirect(cmd *cobra.Command, verbose bool, fn func(runCtx context.Context) (string, error)) (string, bool, error)

RunWithRollingOrDirect executes fn while showing rolling logs when stdout is a TTY and verbose is false. Returns the fn's string result and whether the rolling TUI was used.

func SpinnerOperation

func SpinnerOperation(pr ui.StdPrinter, message string, operation func() error) error

SpinnerOperation runs an operation with a spinner, automatically handling start/stop.

func TestPrintUserFriendly

func TestPrintUserFriendly(err error)

TestPrintUserFriendly exposes printUserFriendly for testing

func ValidateWithDocker

func ValidateWithDocker(ctx context.Context, cfg *manifest.Config, docker *dockercli.Client) error

ValidateWithDocker runs validation against the configuration and Docker client.

func Version

func Version() string

func VersionDetailed

func VersionDetailed() string

VersionDetailed returns version info with build metadata if available.

func VersionSimple added in v0.2.2

func VersionSimple() string

VersionSimple returns version number with build info for --version flag

Types

type CLIContext

type CLIContext struct {
	Ctx     context.Context
	Config  *manifest.Config
	Docker  *dockercli.Client
	Printer ui.Printer
	Planner *planner.Planner
}

CLIContext contains all the components needed for most CLI operations.

func SetupCLIContext

func SetupCLIContext(cmd *cobra.Command) (*CLIContext, error)

SetupCLIContext performs the standard CLI setup: load config, create Docker client, validate, and create planner.

func (*CLIContext) ApplyPlan

func (ctx *CLIContext) ApplyPlan() error

ApplyPlan executes the plan with progress tracking.

func (*CLIContext) BuildDestroyPlan added in v0.2.0

func (ctx *CLIContext) BuildDestroyPlan() (*planner.Plan, error)

BuildDestroyPlan creates a destruction plan for all managed resources.

func (*CLIContext) BuildPlan

func (ctx *CLIContext) BuildPlan() (*planner.Plan, error)

BuildPlan creates a plan using the CLI context with spinner UI.

func (*CLIContext) ExecuteDestroy added in v0.2.0

func (ctx *CLIContext) ExecuteDestroy(bgCtx context.Context) error

ExecuteDestroy executes the destruction of all managed resources.

func (*CLIContext) PrunePlan

func (ctx *CLIContext) PrunePlan() error

PrunePlan executes pruning with spinner.

type ConfirmationOptions

type ConfirmationOptions struct {
	SkipConfirmation bool
	Message          string
}

ConfirmationOptions configures the confirmation prompt behavior.

type DestroyConfirmationOptions added in v0.2.0

type DestroyConfirmationOptions struct {
	SkipConfirmation bool
	Identifier       string
}

DestroyConfirmationOptions configures the destroy confirmation prompt behavior.

Jump to

Keyboard shortcuts

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