Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/display/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmd/display/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 - "
)
1 change: 1 addition & 0 deletions cmd/display/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions cmd/display/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions cmd/display/quiet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/display/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"
)

// Spinner renders an animated terminal spinner to indicate ongoing progress.
type Spinner struct {
time time.Time
index int
Expand All @@ -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{
"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏",
Expand Down Expand Up @@ -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
}