clicmd

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCLICommand

func NewCLICommand(cmd *cobra.Command, opts ...Option) (ppi.Command, error)

NewCLICommand created a CLI command based on a preconfigured cobra.Command. Optionally, a verb can be specified. If given additionally a realm can be given. verb and realm are used to add the command at the appropriate places in the command hierarchy of the ocm CLI. If nothing is specified, the command will be a new top-level command. To access the configured ocm context use the Context attribute of the cobra command. The ocm context is bound to it.

ocm.FromContext(cmd.Context())

Types

type CobraCommand

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

func (*CobraCommand) CLIConfigRequired

func (c *CobraCommand) CLIConfigRequired() bool

func (*CobraCommand) Command

func (c *CobraCommand) Command() *cobra.Command

func (*CobraCommand) Description

func (c *CobraCommand) Description() string

func (*CobraCommand) Example

func (c *CobraCommand) Example() string

func (*CobraCommand) Name

func (c *CobraCommand) Name() string

func (*CobraCommand) ObjectType

func (c *CobraCommand) ObjectType() string

func (*CobraCommand) Realm

func (c *CobraCommand) Realm() string

func (*CobraCommand) Short

func (c *CobraCommand) Short() string

func (*CobraCommand) Usage

func (c *CobraCommand) Usage() string

func (*CobraCommand) Verb

func (c *CobraCommand) Verb() string

type Option

type Option = optionutils.Option[*Options]

func WithCLIConfig

func WithCLIConfig(r ...bool) Option

func WithObjectType

func WithObjectType(r string) Option

func WithRealm

func WithRealm(r string) Option

func WithVerb

func WithVerb(v string) Option

type Options

type Options struct {
	RequireCLIConfig *bool
	Verb             string
	ObjectType       string
	Realm            string
}

func (*Options) ApplyTo

func (o *Options) ApplyTo(opts *Options)

Jump to

Keyboard shortcuts

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