From 357afe197da67b48d4e8fb2b354804e7f759238c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Poyraz=20K=C3=BC=C3=A7=C3=BCkarslan?= <83272398+PoyrazK@users.noreply.github.com> Date: Thu, 5 Mar 2026 20:27:47 +0300 Subject: [PATCH] Add missing godoc comments to cmd/display package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Poyraz Küçükarslan <83272398+PoyrazK@users.noreply.github.com> --- cmd/display/colors.go | 8 ++++++++ cmd/display/dryrun.go | 1 + cmd/display/json.go | 1 + cmd/display/plain.go | 1 + cmd/display/quiet.go | 1 + cmd/display/spinner.go | 4 ++++ 6 files changed, 16 insertions(+) diff --git a/cmd/display/colors.go b/cmd/display/colors.go index a00b4ed6ad5..98eb916a64e 100644 --- a/cmd/display/colors.go +++ b/cmd/display/colors.go @@ -27,15 +27,23 @@ var ( return s } + // DoneColor is the color function used to render the completion indicator. DoneColor colorFunc = aec.BlueF.Apply + // TimerColor is the color function used to render elapsed time. TimerColor colorFunc = aec.BlueF.Apply + // CountColor is the color function used to render counts. CountColor colorFunc = aec.YellowF.Apply + // WarningColor is the color function used to render warning messages. WarningColor colorFunc = aec.YellowF.With(aec.Bold).Apply + // SuccessColor is the color function used to render success messages. SuccessColor colorFunc = aec.GreenF.Apply + // ErrorColor is the color function used to render error messages. ErrorColor colorFunc = aec.RedF.With(aec.Bold).Apply + // PrefixColor is the color function used to render service name prefixes. PrefixColor colorFunc = aec.CyanF.Apply ) +// NoColor disables all terminal color output by replacing color functions with pass-through variants. func NoColor() { DoneColor = nocolor TimerColor = nocolor diff --git a/cmd/display/dryrun.go b/cmd/display/dryrun.go index 2ab542e5b05..e1b9ac3fdb1 100644 --- a/cmd/display/dryrun.go +++ b/cmd/display/dryrun.go @@ -16,6 +16,7 @@ package display +// DRYRUN_PREFIX is the prefix prepended to output lines when running in dry-run mode. const ( DRYRUN_PREFIX = " DRY-RUN MODE - " ) diff --git a/cmd/display/json.go b/cmd/display/json.go index b8873596374..49fbcddd199 100644 --- a/cmd/display/json.go +++ b/cmd/display/json.go @@ -25,6 +25,7 @@ import ( "github.com/docker/compose/v5/pkg/api" ) +// JSON returns an EventProcessor that serializes events as JSON lines to the given writer. func JSON(out io.Writer) api.EventProcessor { return &jsonWriter{ out: out, diff --git a/cmd/display/plain.go b/cmd/display/plain.go index 16f2816c011..b984c9774ed 100644 --- a/cmd/display/plain.go +++ b/cmd/display/plain.go @@ -24,6 +24,7 @@ import ( "github.com/docker/compose/v5/pkg/api" ) +// Plain returns an EventProcessor that writes events as plain text lines to the given writer. func Plain(out io.Writer) api.EventProcessor { return &plainWriter{ out: out, diff --git a/cmd/display/quiet.go b/cmd/display/quiet.go index 8e1537d8061..9eccc42bd11 100644 --- a/cmd/display/quiet.go +++ b/cmd/display/quiet.go @@ -22,6 +22,7 @@ import ( "github.com/docker/compose/v5/pkg/api" ) +// Quiet returns an EventProcessor that silently discards all events. func Quiet() api.EventProcessor { return &quiet{} } diff --git a/cmd/display/spinner.go b/cmd/display/spinner.go index e476deae80f..500e64d53ae 100644 --- a/cmd/display/spinner.go +++ b/cmd/display/spinner.go @@ -21,6 +21,7 @@ import ( "time" ) +// Spinner renders an animated terminal spinner to indicate ongoing progress. type Spinner struct { time time.Time index int @@ -29,6 +30,7 @@ type Spinner struct { done string } +// NewSpinner creates and returns a new Spinner instance with platform-appropriate characters. func NewSpinner() *Spinner { chars := []string{ "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏", @@ -61,10 +63,12 @@ func (s *Spinner) String() string { return s.chars[s.index] } +// Stop marks the spinner as done, causing it to display the completion character. func (s *Spinner) Stop() { s.stop = true } +// Restart resumes the spinner animation after it has been stopped. func (s *Spinner) Restart() { s.stop = false }