display

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupPacksByStatus

func GroupPacksByStatus(packs []PackResult) map[types.ExecutionStatus][]string

GroupPacksByStatus groups packs by their execution status for summary display

Types

type CommandResult

type CommandResult struct {
	// Command is the command that was executed (deploy, install, etc.)
	Command string

	// Packs contains the results for each pack, preserving pack grouping
	Packs []PackResult

	// Summary provides overall statistics
	Summary Summary

	// DryRun indicates if this was a dry run
	DryRun bool

	// Duration is the total execution time
	Duration time.Duration
}

CommandResult represents the complete result of a dodot command execution, formatted for display purposes. This is the top-level structure that encompasses all packs and their operations.

func (*CommandResult) GetOverallStatus

func (cr *CommandResult) GetOverallStatus() types.ExecutionStatus

GetOverallStatus returns the overall command status based on pack results

type Converter

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

Converter transforms execution context data into display-friendly formats

func NewConverter

func NewConverter(homeDir string) *Converter

NewConverter creates a new display converter

func (*Converter) ConvertExecutionContext

func (c *Converter) ConvertExecutionContext(ctx *types.ExecutionContext) CommandResult

ConvertExecutionContext transforms an ExecutionContext into a CommandResult suitable for display. This is the main entry point for converting execution data into the display layer.

func (*Converter) ConvertFileStatus

func (c *Converter) ConvertFileStatus(fs *types.FileStatus) FileResult

ConvertFileStatus transforms a FileStatus (from status checking) into a FileResult This is used when we want to display the current status without execution

func (*Converter) ConvertOperationResult

func (c *Converter) ConvertOperationResult(or *types.OperationResult) FileResult

ConvertOperationResult transforms an OperationResult into a FileResult

func (*Converter) ConvertPackExecutionResult

func (c *Converter) ConvertPackExecutionResult(packName string, per *types.PackExecutionResult) PackResult

ConvertPackExecutionResult transforms a PackExecutionResult into a PackResult

type FileResult

type FileResult struct {
	// Column 1: Action verb based on PowerUp type
	Action string

	// Column 2: File path (relative when possible)
	Path string

	// Column 3: Status/outcome
	Status      types.OperationStatus
	Message     string
	IsNewChange bool // Indicates if this is a new change in this run

	// Additional context preserved from the operation
	PowerUp     string
	Pack        string
	GroupID     string
	Error       error
	Output      string // For command execution results
	LastApplied time.Time

	// Metadata from status checking or operation execution
	Metadata map[string]interface{}
}

FileResult represents a single file operation result, containing all information needed for the three-column display

func (*FileResult) HasOutput

func (fr *FileResult) HasOutput() bool

HasOutput returns true if the file result has command output to display

func (*FileResult) IsSuccess

func (fr *FileResult) IsSuccess() bool

IsSuccess returns true if the file operation was successful

type PackResult

type PackResult struct {
	// Name is the pack name
	Name string

	// Description is an optional pack description
	Description string

	// Files contains all file operations in this pack
	Files []FileResult

	// Status is the aggregated status for this pack
	Status types.ExecutionStatus

	// Statistics for this pack
	TotalOperations     int
	CompletedOperations int
	FailedOperations    int
	SkippedOperations   int
}

PackResult represents the execution results for a single pack, grouping all operations within that pack for cohesive display

func (*PackResult) GroupFilesByPowerUp

func (pr *PackResult) GroupFilesByPowerUp() map[string][]FileResult

GroupFilesByPowerUp groups file results by their PowerUp for organized display

type PlainRenderer

type PlainRenderer struct{}

PlainRenderer implements Renderer with plain text output

func NewPlainRenderer

func NewPlainRenderer() *PlainRenderer

NewPlainRenderer creates a new plain text renderer

func (*PlainRenderer) RenderCommandResult

func (r *PlainRenderer) RenderCommandResult(result CommandResult) string

RenderCommandResult renders the command result as plain text

func (*PlainRenderer) RenderFileResult

func (r *PlainRenderer) RenderFileResult(file FileResult) string

RenderFileResult renders a file result as plain text

func (*PlainRenderer) RenderPackResult

func (r *PlainRenderer) RenderPackResult(pack PackResult) string

RenderPackResult renders a pack result as plain text

func (*PlainRenderer) RenderSummary

func (r *PlainRenderer) RenderSummary(summary Summary) string

RenderSummary renders the summary as plain text

type Renderer

type Renderer interface {
	// RenderCommandResult renders the complete command result
	RenderCommandResult(result CommandResult) string

	// RenderPackResult renders a single pack result
	RenderPackResult(pack PackResult) string

	// RenderFileResult renders a single file result
	RenderFileResult(file FileResult) string

	// RenderSummary renders the command summary
	RenderSummary(summary Summary) string
}

Renderer defines the interface for rendering display results

type RichRenderer

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

RichRenderer implements Renderer with rich terminal output This renderer produces the three-column format specified in the design

func NewRichRenderer

func NewRichRenderer() *RichRenderer

NewRichRenderer creates a new rich terminal renderer

func (*RichRenderer) RenderCommandResult

func (r *RichRenderer) RenderCommandResult(result CommandResult) string

RenderCommandResult renders the complete command result

func (*RichRenderer) RenderFileResult

func (r *RichRenderer) RenderFileResult(file FileResult) string

RenderFileResult renders a single file result in three-column format

func (*RichRenderer) RenderPackResult

func (r *RichRenderer) RenderPackResult(pack PackResult) string

RenderPackResult renders a single pack result

func (*RichRenderer) RenderSummary

func (r *RichRenderer) RenderSummary(summary Summary) string

RenderSummary renders the command summary

type Summary

type Summary struct {
	// Timing information
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration

	// Overall counts
	TotalPacks          int
	TotalOperations     int
	CompletedOperations int
	FailedOperations    int
	SkippedOperations   int

	// Status breakdown by pack
	SuccessfulPacks int
	PartialPacks    int
	FailedPacks     int
	SkippedPacks    int
}

Summary provides overall command execution statistics

Jump to

Keyboard shortcuts

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