cmdparser

package
v2.43.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 17 Imported by: 0

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

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

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