cli

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package cli provides shared runners and command builders for stage commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTagApplySummary

func FormatTagApplySummary(tag stagingusecase.ApplyTagResult) string

FormatTagApplySummary formats a tag apply result as a summary string.

func NewAddCommand

func NewAddCommand(cfg CommandConfig) *cli.Command

NewAddCommand creates an add command with the given config.

func NewApplyCommand

func NewApplyCommand(cfg CommandConfig) *cli.Command

NewApplyCommand creates an apply command with the given config.

func NewDeleteCommand

func NewDeleteCommand(cfg CommandConfig) *cli.Command

NewDeleteCommand creates a delete command with the given config.

func NewDiffCommand

func NewDiffCommand(cfg CommandConfig) *cli.Command

NewDiffCommand creates a diff command with the given config.

func NewEditCommand

func NewEditCommand(cfg CommandConfig) *cli.Command

NewEditCommand creates an edit command with the given config.

func NewGlobalStashCommand

func NewGlobalStashCommand() *cli.Command

NewGlobalStashCommand creates a global stash command group that operates on all services.

func NewResetCommand

func NewResetCommand(cfg CommandConfig) *cli.Command

NewResetCommand creates a reset command with the given config.

func NewStashCommand

func NewStashCommand(cfg CommandConfig) *cli.Command

NewStashCommand creates a service-specific stash command group with the given config.

func NewStatusCommand

func NewStatusCommand(cfg CommandConfig) *cli.Command

NewStatusCommand creates a status command with the given config.

func NewTagCommand

func NewTagCommand(cfg CommandConfig) *cli.Command

NewTagCommand creates a tag command with the given config.

func NewUntagCommand

func NewUntagCommand(cfg CommandConfig) *cli.Command

NewUntagCommand creates an untag command with the given config.

Types

type AddOptions

type AddOptions struct {
	Name        string
	Value       string // Optional: if set, skip editor and use this value
	Description string
}

AddOptions holds options for the add command.

type AddRunner

type AddRunner struct {
	UseCase    *stagingusecase.AddUseCase
	Stdout     io.Writer
	Stderr     io.Writer
	OpenEditor editor.OpenFunc // Optional: defaults to editor.Open if nil
}

AddRunner executes add operations using a usecase.

func (*AddRunner) Run

func (r *AddRunner) Run(ctx context.Context, opts AddOptions) error

Run executes the add command.

type ApplyOptions

type ApplyOptions struct {
	Name            string // Optional: apply only this item, otherwise apply all
	IgnoreConflicts bool   // Skip conflict detection and force apply
}

ApplyOptions holds options for the apply command.

type ApplyRunner

type ApplyRunner struct {
	UseCase *stagingusecase.ApplyUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

ApplyRunner executes apply operations using a usecase.

func (*ApplyRunner) Run

func (r *ApplyRunner) Run(ctx context.Context, opts ApplyOptions) error

Run executes the apply command.

type CommandConfig

type CommandConfig struct {
	// CommandName is the subcommand name (e.g., "param", "secret").
	CommandName string

	// ItemName is the item name for messages (e.g., "parameter", "secret").
	ItemName string

	// Factory creates a FullStrategy with an initialized AWS client.
	Factory staging.StrategyFactory

	// ParserFactory creates a Parser without AWS client (for status, parsing).
	ParserFactory staging.ParserFactory
}

CommandConfig holds service-specific configuration for building stage commands.

type DeleteOptions

type DeleteOptions struct {
	Name           string
	Force          bool // For Secrets Manager: force immediate deletion
	RecoveryWindow int  // For Secrets Manager: days before permanent deletion (7-30)
}

DeleteOptions holds options for the delete command.

type DeleteRunner

type DeleteRunner struct {
	UseCase *stagingusecase.DeleteUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

DeleteRunner executes delete operations using a usecase.

func (*DeleteRunner) Run

func (r *DeleteRunner) Run(ctx context.Context, opts DeleteOptions) error

Run executes the delete command.

type DiffOptions

type DiffOptions struct {
	Name      string // Optional: diff only this item, otherwise diff all
	ParseJSON bool
	NoPager   bool
}

DiffOptions holds options for the diff command.

type DiffRunner

type DiffRunner struct {
	UseCase *stagingusecase.DiffUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

DiffRunner executes diff operations using a usecase.

func (*DiffRunner) OutputDiff

func (r *DiffRunner) OutputDiff(opts DiffOptions, entry stagingusecase.DiffEntry)

OutputDiff outputs a diff entry for an existing resource.

func (*DiffRunner) OutputDiffCreate

func (r *DiffRunner) OutputDiffCreate(opts DiffOptions, entry stagingusecase.DiffEntry)

OutputDiffCreate outputs a diff entry for a newly created resource.

func (*DiffRunner) OutputMetadata

func (r *DiffRunner) OutputMetadata(entry stagingusecase.DiffEntry)

OutputMetadata outputs metadata for a diff entry.

func (*DiffRunner) OutputTagEntry

func (r *DiffRunner) OutputTagEntry(tagEntry stagingusecase.DiffTagEntry)

OutputTagEntry outputs a tag entry.

func (*DiffRunner) Run

func (r *DiffRunner) Run(ctx context.Context, opts DiffOptions) error

Run executes the diff command.

type EditOptions

type EditOptions struct {
	Name        string
	Value       string // Optional: if set, skip editor and use this value
	Description string
}

EditOptions holds options for the edit command.

type EditRunner

type EditRunner struct {
	UseCase    *stagingusecase.EditUseCase
	Stdout     io.Writer
	Stderr     io.Writer
	OpenEditor editor.OpenFunc // Optional: defaults to editor.Open if nil
}

EditRunner executes edit operations using a usecase.

func (*EditRunner) Run

func (r *EditRunner) Run(ctx context.Context, opts EditOptions) error

Run executes the edit command.

type GlobalDropRunner added in v0.7.3

type GlobalDropRunner struct {
	FileStore *file.Store
	Stdout    io.Writer
}

GlobalDropRunner executes global stash drop (delete entire file).

func (*GlobalDropRunner) Run added in v0.7.3

func (r *GlobalDropRunner) Run() error

Run deletes the stash file without reading its contents.

type ResetOptions

type ResetOptions struct {
	Spec string // Name with optional version spec
	All  bool   // Reset all staged items for this service
}

ResetOptions holds options for the reset command.

type ResetRunner

type ResetRunner struct {
	UseCase *stagingusecase.ResetUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

ResetRunner executes reset operations using a usecase.

func (*ResetRunner) Run

func (r *ResetRunner) Run(ctx context.Context, opts ResetOptions) error

Run executes the reset command.

type ServiceDropRunner added in v0.7.3

type ServiceDropRunner struct {
	FileStore *file.Store
	Service   staging.Service
	Stdout    io.Writer
}

ServiceDropRunner executes service-specific stash drop.

func (*ServiceDropRunner) Run added in v0.7.3

func (r *ServiceDropRunner) Run(ctx context.Context) error

Run removes the specified service from the stash file.

type StashPopModeChooser added in v0.7.3

type StashPopModeChooser struct {
	Prompter *confirm.Prompter
	Stderr   io.Writer
	Stdout   io.Writer
}

StashPopModeChooser determines the stash pop mode based on flags and user input.

func (*StashPopModeChooser) ChooseMode added in v0.7.3

ChooseMode determines the stash pop mode, prompting interactively if needed.

type StashPopModeInput added in v0.7.3

type StashPopModeInput struct {
	MergeFlag     bool
	OverwriteFlag bool
	HasChanges    bool
	ItemCount     int
	IsTTY         bool
}

StashPopModeInput holds the input for determining stash pop mode.

type StashPopModeResult added in v0.7.3

type StashPopModeResult struct {
	Mode      stagingusecase.StashMode
	Cancelled bool
}

StashPopModeResult holds the result of mode selection.

type StashPopOptions

type StashPopOptions struct {
	// Service filters the operation to a specific service. Empty means all services.
	Service staging.Service
	// Keep preserves the file after popping.
	Keep bool
	// Mode determines how to handle conflicts with existing agent memory.
	Mode stagingusecase.StashMode
}

StashPopOptions holds options for the stash pop command.

type StashPopRunner

type StashPopRunner struct {
	UseCase *stagingusecase.StashPopUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

StashPopRunner executes stash pop operations using a usecase.

func (*StashPopRunner) Run

Run executes the stash pop command.

type StashPushOptions

type StashPushOptions struct {
	// Service filters the operation to a specific service. Empty means all services.
	Service staging.Service
	// Keep preserves the agent memory after pushing to file.
	Keep bool
	// Mode determines how to handle existing stash file.
	Mode usestaging.StashMode
}

StashPushOptions holds options for the stash push command.

type StashPushRunner

type StashPushRunner struct {
	UseCase   *usestaging.StashPushUseCase
	Stdout    io.Writer
	Stderr    io.Writer
	Encrypted bool // Whether the file is encrypted (for output messages)
}

StashPushRunner executes stash push operations using a usecase.

func (*StashPushRunner) Run

Run executes the stash push command.

type StashShowOptions

type StashShowOptions struct {
	// Service filters the display to a specific service. Empty means all services.
	Service staging.Service
	// Verbose shows detailed information.
	Verbose bool
}

StashShowOptions holds options for the stash show command.

type StashShowRunner

type StashShowRunner struct {
	FileStore *file.Store
	Stdout    io.Writer
	Stderr    io.Writer
}

StashShowRunner executes stash show operations.

func (*StashShowRunner) Run

Run executes the stash show command.

type StatusOptions

type StatusOptions struct {
	Name    string
	Verbose bool
}

StatusOptions holds options for the status command.

type StatusRunner

type StatusRunner struct {
	UseCase *stagingusecase.StatusUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

StatusRunner executes status operations using a usecase.

func (*StatusRunner) Run

func (r *StatusRunner) Run(ctx context.Context, opts StatusOptions) error

Run executes the status command.

type TagOptions

type TagOptions struct {
	Name string
	Tags []string // key=value pairs to add
}

TagOptions holds options for the tag command.

type TagRunner

type TagRunner struct {
	UseCase *stagingusecase.TagUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

TagRunner executes tag staging operations using a usecase.

func (*TagRunner) Run

func (r *TagRunner) Run(ctx context.Context, opts TagOptions) error

Run executes the tag command.

type UntagOptions

type UntagOptions struct {
	Name string
	Keys []string // tag keys to remove
}

UntagOptions holds options for the untag command.

type UntagRunner

type UntagRunner struct {
	UseCase *stagingusecase.TagUseCase
	Stdout  io.Writer
	Stderr  io.Writer
}

UntagRunner executes untag staging operations using a usecase.

func (*UntagRunner) Run

func (r *UntagRunner) Run(ctx context.Context, opts UntagOptions) error

Run executes the untag command.

Jump to

Keyboard shortcuts

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