Documentation ¶
Overview ¶
Package output provides terminal output convenience helpers for namespace type icons and cgroup information rendering.
Index ¶
Constants ¶
const (
IconFlagName = "icon"
)
Names of the CLI flags defined and used in this package.
Variables ¶
var ControlGroupNameModes = map[ControlGroupNames][]string{ CgroupShortened: {"short"}, CgroupComplete: {"full", "complete"}, }
ControlGroupNameModes specifies the mapping between the user-facing CLI flag values and the program-internal flag values.
var NamespaceTypeIcons = map[species.NamespaceType]string{ species.CLONE_NEWCGROUP: "🔧", species.CLONE_NEWIPC: "✉ ", species.CLONE_NEWNS: "📁", species.CLONE_NEWNET: "⇄ ", species.CLONE_NEWPID: "🏃", species.CLONE_NEWUSER: "👤", species.CLONE_NEWUTS: "💻", }
NamespaceTypeIcons maps individual Linux-kernel namespace types (species.NNamespaceTypeIcons) to Unicode characters to be used as icons.
Functions ¶
func ControlgroupDisplayName ¶
ControlgroupDisplayName takes a control group name (path) and, depending on the display flags set, returns a name better suited for display. In particular, it optionally shortens 64 hex digit IDs as used by Docker for identifying containers to the Docker-typical 12 hex digit "digest".
func IconSetupCLI ¶
IconSetupCLI is a plugin function that registers the CLI "--icon" flag.
func LabelSetupCLI ¶
LabelSetupCLI adds the flags for controlling control group name display.
func NamespaceIcon ¶
NamespaceIcon returns an Unicode string which can be displayed as an "icon" for the specified namespace. If showing namespace icons is disabled, then an empty string is always returned instead. If necessary, the returned string contains padding.
func NamespaceReferenceLabel ¶
NamespaceReferenceLabel returns a string describing a reference to the specified namespace, either in form of a (leader) process name and PID, or if there is no such process then in form of a filesystem reference.
Types ¶
type ControlGroupNames ¶
type ControlGroupNames enumflag.Flag
ControlGroupNames defines the enumeration flag type for controlling optimizing control group names for display (or not).
const ( // CgroupShortened enables optimizing the display of Docker container IDs. CgroupShortened ControlGroupNames = iota // CgroupComplete switches off any display optimization of control group // names. CgroupComplete )