Documentation
¶
Overview ¶
Package discovery holds the table cells, section output and empty-result note shared by the deployment-discovery verbs. Importable only from packages below pkg/cmd/.
Index ¶
- Constants
- func Bullet(text string) string
- func ColorForArgoStatus(s string) output.Cell
- func ExpandIngressRows(cells []output.Cell, ingressLines []output.Cell) [][]output.Cell
- func HostnameFromURL(u string) string
- func IngressLines(urls []string) []output.Cell
- func OptCell(s *string) string
- func OptStatusCell(s *string) output.Cell
- func OptTimeCell(at *string) string
- func PrintEmptyNote(ios *iostreams.IOStreams, outputFormat, note string) error
- func PrintSection(w io.Writer, isTTY bool, title string, lines []string) error
- func ShortDigestCell(digest *string) string
Constants ¶
const MaxIngressHostLen = 50
MaxIngressHostLen caps the visible width of an ingress hostname in table mode. The OSC 8 hyperlink target carries the full URL regardless.
const ShortDigestLen = len("sha256:") + 8
ShortDigestLen is the maximum length of an image digest in table mode: the `sha256:` prefix plus the first 8 hex characters.
Variables ¶
This section is empty.
Functions ¶
func Bullet ¶ added in v0.20.0
Bullet returns a PrintSection line: " - " followed by text on one row with its control characters visible. The prefix stays outside SingleLine.
func ColorForArgoStatus ¶
ColorForArgoStatus colors an ArgoCD health status: healthy → green, degraded/missing → red, progressing → blue. Anything else (including suspended/unknown) is left unstyled.
func ExpandIngressRows ¶
ExpandIngressRows turns one logical row (cells without INGRESS) plus a list of ingress lines into N visual rows. The first visual row carries the full data; subsequent rows blank out every cell except INGRESS, producing a vertically-stacked layout:
project1 … ingress1
ingress2
project2 … ingress1
When ingressLines is empty, a single row is emitted with "-" in INGRESS.
func HostnameFromURL ¶
HostnameFromURL strips the scheme and the path from a URL, returning host[:port]. Input without "://" has only its path stripped.
func IngressLines ¶
IngressLines renders an ingress-URL slice as one cell per URL: the hostname (no scheme) truncated to MaxIngressHostLen visible characters. The styled form is an OSC 8 hyperlink to the full URL. Returns nil when urls is empty; callers display a single "-" row in that case.
func OptCell ¶
OptCell renders an optional string field, output.EmptyCell when the pointer is nil or the value is empty.
func OptStatusCell ¶
OptStatusCell renders an ArgoCD health-status cell, output.EmptyCell when the pointer is nil or the value is empty.
func OptTimeCell ¶ added in v0.20.0
OptTimeCell renders an optional RFC 3339 timestamp as a relative time, output.EmptyCell when the pointer is nil.
func PrintEmptyNote ¶ added in v0.20.0
PrintEmptyNote writes the note of an empty result to stderr. Under -o json it writes nothing: the empty array is the answer.
func PrintSection ¶ added in v0.20.0
PrintSection prints a blank line, the heading "<title> (<number of lines>)" and the lines. It prints nothing when there are no lines.
func ShortDigestCell ¶
ShortDigestCell truncates a digest to ShortDigestLen characters for table display. output.EmptyCell when the pointer is nil or the value is empty.
Types ¶
This section is empty.