cli

package
v1.4.2-0...-f9f2dab Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Subcmd

func Subcmd(name string, synopses []string, description string, exitOnError bool) *flag.FlagSet

Subcmd is a subcommand of the main "docker" command. A subcommand represents an action that can be performed from the Docker command line client.

To see all available subcommands, run "docker --help". SubCmd 是"docker"命令的子命令 一个子命令代表一个可以被Docker 命令行客户端完成的动作

要查看所有可用的子命令,运行 "docker --help".

Types

type Cli

type Cli struct {
	Stderr io.Writer

	Usage func()
	// contains filtered or unexported fields
}

Cli represents a command line interface. Cli 结构体是一个命令行接口

func New

func New(handlers ...Handler) *Cli

New instantiates a ready-to-use Cli. 创建一个实例化的Cli对象

func (*Cli) CmdHelp

func (cli *Cli) CmdHelp(args ...string) error

CmdHelp displays information on a Docker command.

If more than one command is specified, information is only shown for the first command.

Usage: docker help COMMAND or docker COMMAND --help CmdHelp 在Docker命令行上显示提示信息

如果指定了多个命令,只显示第一个命令的提示信息

用法:docker help COMMAND 或者 docker COMMAND --help

func (*Cli) Run

func (cli *Cli) Run(args ...string) error

Run executes the specified command. Run方法执行指定的命令

type ClientFlags

type ClientFlags struct {
	FlagSet   *flag.FlagSet
	Common    *CommonFlags
	PostParse func()

	ConfigDir string
}

ClientFlags represents flags for the docker client. ClientFlags 结构体代表docker client的标记信息

type CommonFlags

type CommonFlags struct {
	FlagSet   *flag.FlagSet
	PostParse func()

	Debug      bool
	Hosts      []string
	LogLevel   string
	TLS        bool
	TLSVerify  bool
	TLSOptions *tlsconfig.Options
	TrustKey   string
}

CommonFlags represents flags that are common to both the client and the daemon. CommonFlags 结构包含对于docker 客户端和守护进程通用的标记信息

type Handler

type Handler interface{}

Handler holds the different commands Cli will call It should have methods with names starting with `Cmd` like:

func (h myHandler) CmdFoo(args ...string) error

Handler接口 可以表示Cli将要调用的不同命令 命令方法名必须以'Cmd'开头,例如: func (h myHandler) CmdFoo(args ...string) error

type Initializer

type Initializer interface {
	Initialize() error
}

Initializer can be optionally implemented by a Handler to initialize before each call to one of its commands. Initializer接口 可以被一个Handler作为可选实现, Initializer接口在调用每一个Handler命令之前进行初始化

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
}

An StatusError reports an unsuccessful exit by a command. StatusError 结构体报告命令的非正常退出

func (StatusError) Error

func (e StatusError) Error() string

Jump to

Keyboard shortcuts

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