Documentation ¶
Index ¶
- Constants
- func DisplayablePorts(ports []types.Port) string
- func FormatLabels(labels map[string]string) string
- func FormatPorts(ports []swarm.PortConfig) string
- func FormatSwarmNetworks(networks []swarm.NetworkAttachmentConfig) string
- func PrettyPrint(i interface{}) string
- func TruncateID(id string) string
- type ContainerFormatter
- func (c *ContainerFormatter) Command() string
- func (c *ContainerFormatter) CreatedAt() string
- func (c *ContainerFormatter) ID() string
- func (c *ContainerFormatter) Image() string
- func (c *ContainerFormatter) Labels() string
- func (c *ContainerFormatter) Names() string
- func (c *ContainerFormatter) Ports() string
- func (c *ContainerFormatter) RunningFor() string
- func (c *ContainerFormatter) Size() string
- func (c *ContainerFormatter) Status() string
- type Context
- type Format
- type HeaderContext
- type ImageFormatter
- type NetworkFormatter
- func (formatter *NetworkFormatter) Containers() string
- func (formatter *NetworkFormatter) Driver() string
- func (formatter *NetworkFormatter) Gateway() string
- func (formatter *NetworkFormatter) ID() string
- func (formatter *NetworkFormatter) Name() string
- func (formatter *NetworkFormatter) Scope() string
- func (formatter *NetworkFormatter) Services() string
- func (formatter *NetworkFormatter) Subnet() string
- type SubFormat
- type TaskStringer
- func (t *TaskStringer) CurrentState() string
- func (t *TaskStringer) DesiredState() string
- func (t *TaskStringer) Error() string
- func (t *TaskStringer) ID() string
- func (t *TaskStringer) Image() string
- func (t *TaskStringer) Name() string
- func (t *TaskStringer) NodeID() string
- func (t *TaskStringer) Ports() string
Constants ¶
const ( TableFormatKey = "table" RawFormatKey = "raw" PrettyFormatKey = "pretty" )
Format keys used to specify certain kinds of output formats
Variables ¶
This section is empty.
Functions ¶
func DisplayablePorts ¶
DisplayablePorts formats the given ports information for displaying
func FormatLabels ¶
FormatLabels returns the string representation of the given labels.
func FormatPorts ¶
func FormatPorts(ports []swarm.PortConfig) string
FormatPorts returns the string representation of the given PortConfig
func FormatSwarmNetworks ¶
func FormatSwarmNetworks(networks []swarm.NetworkAttachmentConfig) string
FormatSwarmNetworks returns the string representation of the given slice of NetworkAttachmentConfig
func PrettyPrint ¶
func PrettyPrint(i interface{}) string
PrettyPrint creates a string representation of the given vale for human formatted output by uppercasing the first letter.
func TruncateID ¶
TruncateID returns a shorthand version of the given string identifier
Types ¶
type ContainerFormatter ¶
type ContainerFormatter struct {
// contains filtered or unexported fields
}
ContainerFormatter knows how to pretty-print the information of a container
func NewContainerFormatter ¶
func NewContainerFormatter(c *docker.Container, trunc bool) *ContainerFormatter
NewContainerFormatter creates a new container formatter
func (*ContainerFormatter) Command ¶
func (c *ContainerFormatter) Command() string
Command prettifies the command that starts the container
func (*ContainerFormatter) CreatedAt ¶
func (c *ContainerFormatter) CreatedAt() string
CreatedAt prettifies the command that starts the container
func (*ContainerFormatter) Image ¶
func (c *ContainerFormatter) Image() string
Image prettifies the image used by the container
func (*ContainerFormatter) Labels ¶
func (c *ContainerFormatter) Labels() string
Labels prettifies the container labels
func (*ContainerFormatter) Names ¶
func (c *ContainerFormatter) Names() string
Names prettifies the container name(s)
func (*ContainerFormatter) Ports ¶
func (c *ContainerFormatter) Ports() string
Ports prettifies the container port information
func (*ContainerFormatter) RunningFor ¶
func (c *ContainerFormatter) RunningFor() string
RunningFor prettifies the that starts the container
func (*ContainerFormatter) Size ¶
func (c *ContainerFormatter) Size() string
Size prettifies the container size
func (*ContainerFormatter) Status ¶
func (c *ContainerFormatter) Status() string
Status prettifies the container status
type Context ¶
type Context struct { // Output is the output stream to which the formatted string is written. Output io.Writer // Format is used to choose raw, table or custom format for the output. Format Format // Trunc when set to true will truncate the output of certain fields such as Container ID. Trunc bool // contains filtered or unexported fields }
Context contains information required by the formatter to print the output as desired.
type Format ¶
type Format string
Format is the format string rendered using the Context
type HeaderContext ¶
type HeaderContext struct {
// contains filtered or unexported fields
}
HeaderContext provides the subContext interface for managing headers
func (*HeaderContext) FullHeader ¶
func (c *HeaderContext) FullHeader() interface{}
FullHeader returns the header as an interface
type ImageFormatter ¶
type ImageFormatter struct {
// contains filtered or unexported fields
}
ImageFormatter knows how to pretty-print the information of an image
func NewImageFormatter ¶
func NewImageFormatter(image types.ImageSummary, trunc bool) *ImageFormatter
NewImageFormatter creates an image formatter
func (*ImageFormatter) CreatedSince ¶
func (formatter *ImageFormatter) CreatedSince() string
CreatedSince prettifies the image creation date
func (*ImageFormatter) Digest ¶
func (formatter *ImageFormatter) Digest() string
Digest prettifies the image digestv
func (*ImageFormatter) Repository ¶
func (formatter *ImageFormatter) Repository() string
Repository prettifies the repository
func (*ImageFormatter) Size ¶
func (formatter *ImageFormatter) Size() string
Size prettifies the image size
type NetworkFormatter ¶
type NetworkFormatter struct {
// contains filtered or unexported fields
}
NetworkFormatter knows how to pretty-print the information of an network
func NewNetworkFormatter ¶
func NewNetworkFormatter(network types.NetworkResource, trunc bool) *NetworkFormatter
NewNetworkFormatter creates an network formatter
func (*NetworkFormatter) Containers ¶
func (formatter *NetworkFormatter) Containers() string
Containers prettifies the number of containers using the network
func (*NetworkFormatter) Driver ¶
func (formatter *NetworkFormatter) Driver() string
Driver prettifies the network driver
func (*NetworkFormatter) Gateway ¶
func (formatter *NetworkFormatter) Gateway() string
Gateway prettifies the network gateway
func (*NetworkFormatter) Name ¶
func (formatter *NetworkFormatter) Name() string
Name prettifies the network name
func (*NetworkFormatter) Scope ¶
func (formatter *NetworkFormatter) Scope() string
Scope prettifies the network scope
func (*NetworkFormatter) Services ¶
func (formatter *NetworkFormatter) Services() string
Services prettifies the number of containers using the network
func (*NetworkFormatter) Subnet ¶
func (formatter *NetworkFormatter) Subnet() string
Subnet prettifies the network subnet
type TaskStringer ¶
type TaskStringer struct {
// contains filtered or unexported fields
}
TaskStringer converts to it string representation Task attributes
func NewTaskStringer ¶
NewTaskStringer creates a TaskStringer for the given task
func (*TaskStringer) CurrentState ¶
func (t *TaskStringer) CurrentState() string
CurrentState Task current state as a string
func (*TaskStringer) DesiredState ¶
func (t *TaskStringer) DesiredState() string
DesiredState Task desired state as a string
func (*TaskStringer) Error ¶
func (t *TaskStringer) Error() string
Error Task status error as a string