Documentation
¶
Overview ¶
Package show provides the generic show command shared by every provider.
The scaffolding here owns the control flow that is identical across providers: argument validation, the --raw/--output=json mutual-exclusion check, pager gating, and the raw/json/text dispatch. Everything that differs between providers — the version-spec grammar, the parse-json rules, and the exact metadata field layout / JSON shape — lives behind the Presenter, so each provider reproduces its own byte-identical output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config[S any] struct { // Usage is the one-line command usage string. Usage string // ArgsUsage is the positional-arguments usage string. ArgsUsage string // Description is the long help text. Description string // UsageError is returned when the resource name argument is missing. UsageError string // ParseSpec parses the raw name argument into the provider's version spec. ParseSpec func(arg string) (S, error) // NewPresenter builds the provider Presenter bound to the parsed spec (this // is where the provider constructs its AWS client and usecase). NewPresenter func(ctx context.Context, spec S) (Presenter, error) }
Config holds the provider-specific configuration for the show command.
type Presenter ¶
type Presenter interface {
// Fetch resolves the version spec and loads the entry via the provider usecase.
Fetch(ctx context.Context) error
// Value returns the display value. When parseJSON is set it applies the
// provider's parse-json rules (which may warn to stderr) and records internal
// state used by the render methods.
Value(parseJSON bool, stderr io.Writer) string
// RenderText writes the metadata block followed by the value.
RenderText(stdout io.Writer, value string)
// RenderJSON writes the provider-specific JSON output.
RenderJSON(stdout io.Writer, value string) error
}
Presenter renders a single show result for a specific provider. Implementations are stateful: Fetch loads the entry, and the subsequent methods render it.