cli

package
v0.0.0-...-536613a Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version of Current REST API
	Version version.Version = "1"

	// MinVersion represents Minimun REST API version supported
	MinVersion version.Version = "1.12"

	// DefaultDockerfileName is the Default filename with Docker commands, read by docker build
	DefaultDockerfileName string = "Dockerfile"

	DefaultConfigName string = "config.yml"
)

Common constants for daemon and client.

Variables

View Source
var Get3WCommands = make(map[string]Command)

Get3WCommands stores all the Get3W command

Functions

func MatchesContentType

func MatchesContentType(contentType, expectedType string) bool

MatchesContentType validates the content type against the expected one

func Subcmd

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

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

To see all available subcommands, run "get3w --help".

Types

type Cli

type Cli struct {
	Stderr io.Writer

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

Cli represents a command line interface.

func New

func New(handlers ...Handler) *Cli

New instantiates a ready-to-use Cli.

func (*Cli) CmdHelp

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

CmdHelp displays information on a Get3W command.

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

Usage: get3w help COMMAND or get3w COMMAND --help

func (*Cli) Run

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

Run executes the specified command.

type ClientFlags

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

ClientFlags represents flags for the docker client.

type Command

type Command struct {
	Name        string
	Description string
}

Command is the struct contains command name and description

type CommonFlags

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

	Debug    bool
	LogLevel string
	TrustKey string
}

CommonFlags represents flags that are common to both the client and the daemon.

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

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.

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
}

An StatusError reports an unsuccessful exit by a command.

func (StatusError) Error

func (e StatusError) Error() string

Directories

Path Synopsis
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.

Jump to

Keyboard shortcuts

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