Documentation
¶
Index ¶
- func BuildRoot(spec RootSpec, reg *resource.Registry, ctx *agentops.AppContext) *cobra.Command
- func Execute(spec RootSpec, args []string) int
- func ExecuteRoot(root *cobra.Command, args []string) int
- func GenerateResourceCommands(reg *resource.Registry, root *cobra.Command, ctx *agentops.AppContext)
- func NewRoot(spec RootSpec) *cobra.Command
- func RenderDoctorReport(w io.Writer, report agentops.DoctorReport, jsonMode bool) error
- func RenderRecords(w io.Writer, records []resource.Record, schema resource.ResourceSchema, ...) error
- type CommandSpec
- type Envelope
- type OutputMode
- type RootSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRoot ¶
BuildRoot creates a root command with global flags and auto-generated resource commands.
func ExecuteRoot ¶
ExecuteRoot runs a pre-built root command with exit code handling.
func GenerateResourceCommands ¶
func GenerateResourceCommands(reg *resource.Registry, root *cobra.Command, ctx *agentops.AppContext)
GenerateResourceCommands walks the registry and creates noun-verb commands. For each resource:
- Always: create, list, get
- If Validator: validate
- If Deleter: remove
- If Syncer: sync
- If Transitioner: transition
func RenderDoctorReport ¶
RenderDoctorReport renders a DoctorReport as JSON or table.
func RenderRecords ¶
func RenderRecords(w io.Writer, records []resource.Record, schema resource.ResourceSchema, mode OutputMode, fields []string, jqExpr string) error
RenderRecords renders records based on output mode.
Types ¶
type CommandSpec ¶
CommandSpec describes a subcommand registered under the root command.
type Envelope ¶
type Envelope struct {
OK bool `json:"ok"`
Kind string `json:"kind"`
Data []map[string]any `json:"data"`
Warnings []string `json:"warnings,omitempty"`
}
Envelope is the JSON output wrapper.
type OutputMode ¶
type OutputMode int
OutputMode for rendering records.
const ( OutputAuto OutputMode = iota // TTY→table, pipe→TSV OutputJSON // --json field1,field2 OutputJQ // --jq expression )
Click to show internal directories.
Click to hide internal directories.