Documentation
¶
Overview ¶
Package cli provides shared CLI helpers used across Deployah commands.
It defines exit codes, release view models for table and structured output, and rendering utilities that keep command handlers consistent.
Exit codes ¶
Use ExitSuccess, ExitError, and related constants so every command reports failures the same way to shells and CI.
Index ¶
Constants ¶
const ( // ExitSuccess indicates successful program execution ExitSuccess = 0 // ExitError is the exit code used when the application encounters an error ExitError = 1 // ExitTimedOut is the exit code used when the application times out ExitTimedOut = 124 )
Exit Codes
const ( // OutputFormatTable formats output as a table OutputFormatTable = "table" // OutputFormatJSON formats output as JSON OutputFormatJSON = "json" // OutputFormatYAML formats output as YAML OutputFormatYAML = "yaml" )
Output Formats
const OutputFormatTree = "tree"
OutputFormatTree formats output as a tree
Variables ¶
var DeleteOutputFormats = []string{OutputFormatTree, OutputFormatJSON, OutputFormatYAML}
DeleteOutputFormats lists valid output formats for delete dry-run preview.
var OutputFormats = []string{OutputFormatTable, OutputFormatJSON, OutputFormatYAML}
OutputFormats contains all valid output formats
Functions ¶
Types ¶
type ReleaseViewModel ¶
type ReleaseViewModel struct {
Project string `json:"project" yaml:"project"`
Environment string `json:"environment" yaml:"environment"`
Release string `json:"release" yaml:"release"`
Namespace string `json:"namespace" yaml:"namespace"`
Status string `json:"status" yaml:"status"`
Revision int `json:"revision" yaml:"revision"`
LastDeployed string `json:"lastDeployed" yaml:"lastDeployed"`
Age string `json:"age" yaml:"age"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Values map[string]any `json:"values,omitempty" yaml:"values,omitempty"`
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
PodCount int `json:"podCount" yaml:"podCount"`
ReadyPods int `json:"readyPods" yaml:"readyPods"`
PodStatus string `json:"podStatus" yaml:"podStatus"` // e.g., "3/3", "2/3", "0/3"
}
ReleaseViewModel is the JSON and YAML output shape for Helm releases. Field values match the table output for the same release.
func ReleaseToViewModel ¶
func ReleaseToViewModel(rel *v1.Release) ReleaseViewModel
ReleaseToViewModel converts a Helm release to a view model for output.
func ReleaseToViewModelWithPods ¶
func ReleaseToViewModelWithPods(ctx context.Context, k8sClient *k8s.Client, rel *v1.Release) ReleaseViewModel
ReleaseToViewModelWithPods converts a Helm release to a view model with pod information.