cmdparser

package
v2.60.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 20 Imported by: 1 module, 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

View Source
var (
	PresetQueryInventory         = "query-inventory"
	PresetGetIdentity            = "get-identity"
	PresetQueryInventoryChildren = "query-inventory-children"
)
View Source
var (
	CommonFlagsQuery                = "query"
	CommonFlagsTemplate             = "queryTemplate"
	CommonFlagsOrderBy              = "orderBy"
	CommonFlagsName                 = "name"
	CommonFlagsType                 = "type"
	CommonFlagsAgents               = "agents"
	CommonFlagsFragmentType         = "fragmentType"
	CommonFlagsOwner                = "owner"
	CommonFlagsAvailability         = "availability"
	CommonFlagsLastMessageDateTo    = "lastMessageDateTo"
	CommonFlagsLastMessageDateFrom  = "lastMessageDateFrom"
	CommonFlagsCreationTimeDateTo   = "creationTimeDateTo"
	CommonFlagsCreationTimeDateFrom = "creationTimeDateFrom"
	CommonFlagsGroup                = "group"
	CommonFlagsSkipChildrenNames    = "skipChildrenNames"
	CommonFlagsWithChildren         = "withChildren"
	CommonFlagsWithChildrenCount    = "withChildrenCount"
	CommonFlagsWithGroups           = "withGroups"
	CommonFlagsWithParents          = "withParents"
)

Functions

func AddFlag

func AddFlag(cmd *CmdOptions, p *models.Parameter, factory *cmdutil.Factory) error

func AddPredefinedGroupsFlags

func AddPredefinedGroupsFlags(cmd *CmdOptions, factory *cmdutil.Factory, template models.CommandPreset)

func AppendCompletionOptions

func AppendCompletionOptions(opts []completion.Option, cmd *CmdOptions, p *models.Parameter, factory *cmdutil.Factory) []completion.Option

func ApplyCommandFilter added in v2.57.0

func ApplyCommandFilter(options config.CommonCommandOptions, spec models.Command) error

ApplyCommandFilter adds the client side filters of an extension API command to the output filters. The filters are combined with the filters provided by the user (via --filter), so the user can only narrow the results further.

The common options are cached by the configuration and the filters are referenced by pointer, so the filters are used when the response is processed

func ApplyCommandView added in v2.57.0

func ApplyCommandView(factory *cmdutil.Factory, cfg *config.Config, spec models.Command) error

ApplyCommandView activates the default view of an extension API command. The view is only applied when automatic view detection is active, so it does not override views selected by the user (e.g. --view <name> or --view off). The --select flag is not affected, as it already takes precedence over views

func GetCompletionOptions

func GetCompletionOptions(cmd *CmdOptions, p *models.Parameter, factory *cmdutil.Factory) completion.Option

func GetOption

func GetOption(cmd *CmdOptions, p *models.Parameter, factory *cmdutil.Factory, args []string) []flags.GetOption

func MapCommandAPI

func MapCommandAPI(cmd *CmdOptions, param *models.Parameter, typeName string)

func NewCommandFromSpec added in v2.57.0

func NewCommandFromSpec(item models.Command, factory *cmdutil.Factory, origin string) (*cobra.Command, error)

NewCommandFromSpec creates the runtime command for a single command in an extension API specification. The origin (e.g. the file path of the specification) is only used in log messages.

func ParseCommand

func ParseCommand(r io.Reader, factory *cmdutil.Factory, rootCmd *cobra.Command) (*cobra.Command, error)

ParseCommand parses an extension API specification and returns a cobra command group containing all of the commands defined in the specification. It returns nil if the specification's group should be skipped.

func ParseSpec added in v2.57.0

func ParseSpec(r io.Reader) (*models.Specification, error)

ParseSpec reads an extension API specification

func ResolveCommandView added in v2.57.0

func ResolveCommandView(dataView *dataview.DataView, spec models.Command) (*dataview.Definition, error)

ResolveCommandView returns the view definition of an extension API command. Columns take precedence over the view name. A view name is looked up in the command's extension first, and then in all views. nil is returned if the view name does not match any view

func StringArg

func StringArg(cmd *CmdOptions, param *models.Parameter)

Types

type BodyOptions

type BodyOptions struct {
	Options              []flags.GetOption
	IsBinary             bool
	Initialize           bool
	DefaultValue         []byte
	UploadProgressSource string
}

type CmdOptions

type CmdOptions struct {
	Spec           models.Command
	Completion     []completion.Option
	Command        *cobra.Command
	Runtime        []flags.Option
	Header         []flags.GetOption
	QueryParameter []flags.GetOption
	FormData       []flags.GetOption
	Body           BodyOptions
	Path           PathOptions
	RequiredFlags  []string
}

func NewCommandWithOptions

func NewCommandWithOptions(cmd *cobra.Command, endpoint models.Command) *CmdOptions

func (*CmdOptions) NewRuntimeCommand

func (c *CmdOptions) NewRuntimeCommand(f *cmdutil.Factory) *RuntimeCmd

type Command

type Command struct {
	Name string `yaml:"name"`
}

type PathOptions

type PathOptions struct {
	Template string
	Options  []flags.GetOption
}

type RuntimeCmd

type RuntimeCmd struct {
	*subcommand.SubCommand
	// contains filtered or unexported fields
}

func NewRuntimeCmd

func NewRuntimeCmd(f *cmdutil.Factory, options *CmdOptions) *RuntimeCmd

NewRuntimeCmd creates a command which is created at runtime

func (*RuntimeCmd) Prepare

func (n *RuntimeCmd) Prepare(args []string) error

func (*RuntimeCmd) RunE

func (n *RuntimeCmd) RunE(cmd *cobra.Command, args []string) error

RunE executes the command

Jump to

Keyboard shortcuts

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