cmdutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(cmd *cobra.Command, name string) bool

func Changed

func Changed(cmd *cobra.Command, name string) bool

func Int

func Int(cmd *cobra.Command, name string) int

func RegisterFlags

func RegisterFlags(cmd *cobra.Command, defs []api.FlagDef, opName string, opts *FlagOpts)

RegisterFlags registers CLI flags from generated FlagDef definitions. opName is stored as a Cobra annotation so --schema can look it up at runtime. The Args validator is wrapped to allow --schema to bypass checks.

func RequireAll

func RequireAll(cmd *cobra.Command, names ...string) error

func RequireStr

func RequireStr(cmd *cobra.Command, name string) (string, error)

func Str

func Str(cmd *cobra.Command, name string) string

Types

type FlagOpts

type FlagOpts struct {
	Defaults map[string]string // OAS name → default value override
}

FlagOpts configures RegisterFlags behavior. All map keys use OAS names.

type PatchHelper

type PatchHelper struct {
	// contains filtered or unexported fields
}

PatchHelper tracks which flags were explicitly set, reducing boilerplate in PATCH command handlers that conditionally set body fields.

func NewPatchHelper

func NewPatchHelper(cmd *cobra.Command) *PatchHelper

func (*PatchHelper) AnyChanged

func (p *PatchHelper) AnyChanged() bool

func (*PatchHelper) Bool

func (p *PatchHelper) Bool(flag string, target *bool)

func (*PatchHelper) Int

func (p *PatchHelper) Int(flag string, target *int)

func (*PatchHelper) Str

func (p *PatchHelper) Str(flag string, target *string)

func (*PatchHelper) Strs

func (p *PatchHelper) Strs(flag string, target *[]string)

Jump to

Keyboard shortcuts

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