base

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	BaseCobraCommand  func() *cobra.Command
	Long              string
	Example           string
	Run               func(s *state.State, cmd *cobra.Command, args []string) error
	ValidArgsFunction func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
}

Cmd is a generic wrapper for imperative (action) commands that don't return a resource. Use for delete, wait, use, set, and similar operations.

func (Cmd) CobraCommand

func (gc Cmd) CobraCommand(s *state.State) *cobra.Command

CobraCommand builds a cobra.Command from this Cmd.

type CreateCmd

type CreateCmd[T any] struct {
	BaseCobraCommand  func() *cobra.Command
	Long              string
	Example           string
	Run               func(s *state.State, cmd *cobra.Command, args []string) (T, error)
	PrintResource     func(cmd *cobra.Command, out io.Writer, resource T)
	ValidArgsFunction func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
}

CreateCmd defines a command for creating a resource. BaseCobraCommand builds the cobra.Command with Use, Short, Args, and flag definitions. Read flags in Run via cmd.Flags().GetString() etc. — do not use bound vars.

func (CreateCmd[T]) CobraCommand

func (cc CreateCmd[T]) CobraCommand(s *state.State) *cobra.Command

CobraCommand builds a cobra.Command from this CreateCmd.

type DescribeCmd

type DescribeCmd[T any] struct {
	Use               string
	Short             string
	Long              string
	Example           string
	Args              cobra.PositionalArgs
	Fetch             func(s *state.State, cmd *cobra.Command, args []string) (T, error)
	PrintText         func(cmd *cobra.Command, out io.Writer, resource T) error
	ValidArgsFunction func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
}

DescribeCmd defines a command for fetching and displaying a single resource.

func (DescribeCmd[T]) CobraCommand

func (dc DescribeCmd[T]) CobraCommand(s *state.State) *cobra.Command

CobraCommand builds a cobra.Command from this DescribeCmd.

type ListCmd

type ListCmd[T any] struct {
	Use               string
	Short             string
	Long              string
	Example           string
	Args              cobra.PositionalArgs // optional; defaults to cobra.NoArgs
	Fetch             func(s *state.State, cmd *cobra.Command) (T, error)
	OutputTable       func(cmd *cobra.Command, out io.Writer, resp T) (output.TableRenderer, error)
	ValidArgsFunction func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
}

ListCmd defines a command for fetching and displaying a list response. T is the full response proto message (e.g. *clusterv1.ListClustersResponse).

OutputTable must be set. When set, --no-headers is automatically registered and handled.

func (ListCmd[T]) CobraCommand

func (lc ListCmd[T]) CobraCommand(s *state.State) *cobra.Command

CobraCommand builds a cobra.Command from this ListCmd.

type UpdateCmd

type UpdateCmd[T any] struct {
	BaseCobraCommand  func() *cobra.Command
	Long              string
	Example           string
	Fetch             func(s *state.State, cmd *cobra.Command, args []string) (T, error)
	Update            func(s *state.State, cmd *cobra.Command, resource T) (T, error)
	PrintResource     func(cmd *cobra.Command, out io.Writer, resource T)
	ValidArgsFunction func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
}

UpdateCmd defines a command for updating a resource. BaseCobraCommand builds the cobra.Command with Use, Short, Args, and flag definitions. Fetch retrieves the existing resource; Update applies changes and returns the updated one. Read flags in Update via cmd.Flags().GetString() etc. — do not use bound vars.

func (UpdateCmd[T]) CobraCommand

func (uc UpdateCmd[T]) CobraCommand(s *state.State) *cobra.Command

CobraCommand builds a cobra.Command from this UpdateCmd.

Jump to

Keyboard shortcuts

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