Skip to content
Merged
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
4 changes: 2 additions & 2 deletions internal/devbox/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func (d *Devbox) ListServices(ctx context.Context, runInCurrentShell bool) error
fmt.Fprintln(d.stderr, "Error listing services: ", err)
} else {
fmt.Fprintln(d.stderr, "Services running in process-compose:")
fmt.Fprintln(tw, "NAME\tSTATUS\tEXIT CODE")
fmt.Fprintln(tw, "PID\tNAME\tNAMESPACE\tSTATUS\tAGE\tHEALTH\tRESTARTS\tEXIT CODE")
for _, s := range pcSvcs {
fmt.Fprintf(tw, "%s\t%s\t%d\n", s.Name, s.Status, s.ExitCode)
fmt.Fprintf(tw, "%d\t%s\t%s\t%s\t%s\t%s\t%d\t%d\n", s.PID, s.Name, s.Namespace, s.Status, s.Age, s.Health, s.Restarts, s.ExitCode)
}
tw.Flush()
}
Expand Down
23 changes: 17 additions & 6 deletions internal/services/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ import (
"fmt"
"io"
"net/http"
"time"

"github.com/f1bonacc1/process-compose/src/types"
)

type processStates = types.ProcessesState

type Process struct {
Name string
Status string
ExitCode int
PID int
Name string
Namespace string
Status string
Age time.Duration
Health string
Restarts int
ExitCode int
}

func StartServices(ctx context.Context, w io.Writer, serviceName, projectDir string) error {
Expand Down Expand Up @@ -91,9 +97,14 @@ func ListServices(ctx context.Context, projectDir string, w io.Writer) ([]Proces
}
for _, process := range processes.States {
results = append(results, Process{
Name: process.Name,
Status: process.Status,
ExitCode: process.ExitCode,
PID: process.Pid,
Name: process.Name,
Namespace: process.Namespace,
Status: process.Status,
Age: process.Age.Round(time.Second),
Health: process.Health,
Restarts: process.Restarts,
ExitCode: process.ExitCode,
})
}
return results, nil
Expand Down
Loading