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.
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.
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.
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.