cli

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlagErrorFunc

func FlagErrorFunc(cmd *cobra.Command, err error) error

func NoArgs

func NoArgs(cmd *cobra.Command, args []string) error

func RequiresMinArgs

func RequiresMinArgs(min int) cobra.PositionalArgs

func SetupRootCommand

func SetupRootCommand(rootCmd *cobra.Command) *cliflags.ClientOptions

func VisitAll

func VisitAll(root *cobra.Command, fn func(*cobra.Command))

Types

type Errors

type Errors []error

func (Errors) Error

func (errList Errors) Error() string

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
}

StatusError 打印一个不成功的退出

func (StatusError) Error

func (e StatusError) Error() string

type TopLevelCommand

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

func NewTopLevelCommand

func NewTopLevelCommand(cmd *cobra.Command, dockerCli *cmd.SudockerCli, opts *cliflags.ClientOptions, flags *pflag.FlagSet) *TopLevelCommand

NewTopLevelCommand 返回一个 new TopLevelCommand 对象

func (*TopLevelCommand) HandleGlobalFlags

func (tcmd *TopLevelCommand) HandleGlobalFlags() (*cobra.Command, []string, error)

HandleGlobalFlags 解析全局flag eg. sudocker --debug true run xxx

func (*TopLevelCommand) Initialize

func (tcmd *TopLevelCommand) Initialize(ops ...cmd.CLIOption) error

通过解析全局option来初始化sudocker 客户端

func (*TopLevelCommand) SetArgs

func (tcmd *TopLevelCommand) SetArgs(args []string)

SetArgs 通过设置参数用来调用命令

func (*TopLevelCommand) SetFlag

func (tcmd *TopLevelCommand) SetFlag(name, value string)

SetFlag 设置top command的flag到flagset中

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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