list

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package list provides the generic list command shared by every provider.

The output rendering (names-only, --show text, and JSON forms) is identical across providers; only the small per-provider Config (help text, flag set, and the provider usecase wiring that produces the entries) varies. Note that list does not use a pager: it writes straight to the root writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(cfg Config) *cli.Command

Command returns the generic list command wired with the provider Config.

Types

type Config

type Config 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
	// Flags is the provider's flag set (param adds --recursive; secret does not).
	Flags []cli.Flag
	// NewList builds the entry-producing closure from the CLI context. withValue
	// mirrors the shared --show flag so the provider can request values.
	NewList func(ctx context.Context, cmd *cli.Command, withValue bool) (func(context.Context) ([]Entry, error), error)
}

Config holds the provider-specific configuration for the list command.

type Entry

type Entry struct {
	Name  string
	Value *string
	Error error
}

Entry is a provider-neutral list row: a name plus an optional value or error.

type JSONOutputItem

type JSONOutputItem struct {
	Name  string  `json:"name"`
	Value *string `json:"value,omitempty"` // nil when error or not requested, pointer to distinguish from empty string
	Error string  `json:"error,omitempty"`
}

JSONOutputItem represents a single item in JSON output.

type Options

type Options struct {
	Show   bool
	Output output.Format
}

Options holds the shared list options.

type Runner

type Runner struct {
	List    func(ctx context.Context) ([]Entry, error)
	Options Options
	Stdout  io.Writer
	Stderr  io.Writer
}

Runner executes the list command over a provider-supplied entry source.

func (*Runner) Run

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

Run executes the list command.

Jump to

Keyboard shortcuts

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