package common

import "github.com/docker/swarmkit/cmd/swarmctl/common"

Index

Functions

func Context

func Context(cmd *cobra.Command) context.Context

Context returns a request context based on CLI arguments.

func Dial

func Dial(cmd *cobra.Command) (api.ControlClient, error)

Dial establishes a connection and creates a client. It infers connection parameters from CLI options.

func FprintfIfNotEmpty

func FprintfIfNotEmpty(w io.Writer, format string, v interface{})

FprintfIfNotEmpty prints only if `s` is not empty.

NOTE(stevvooe): Not even remotely a printf function.. doesn't take args.

func ParseLogDriverFlags

func ParseLogDriverFlags(flags *pflag.FlagSet) (*api.Driver, error)

ParseLogDriverFlags parses a silly string format for log driver and options. Fully baked log driver config should be returned.

If no log driver is available, nil, nil will be returned.

func PrintHeader

func PrintHeader(w io.Writer, columns ...string)

PrintHeader prints a nice little header.

func TimestampAgo

func TimestampAgo(ts *tspb.Timestamp) string

TimestampAgo returns a relatime time string from a timestamp (e.g. "12 seconds ago").

Types

type Resolver

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

Resolver provides ID to Name resolution.

func NewResolver

func NewResolver(cmd *cobra.Command, c api.ControlClient) *Resolver

NewResolver creates a new Resolver.

func (*Resolver) Resolve

func (r *Resolver) Resolve(t interface{}, id string) string

Resolve will attempt to resolve an ID to a Name by querying the manager. Results are stored into a cache. If the `-n` flag is used in the command-line, resolution is disabled.

Source Files

common.go print.go resolver.go

Version
v1.12.0 (latest)
Published
Jul 26, 2016
Platform
linux/amd64
Imports
15 packages
Last checked
3 hours ago

Tools for package owners.