diff --git a/internal/devbox/services.go b/internal/devbox/services.go index 10237905bd0..a1fc49d73e9 100644 --- a/internal/devbox/services.go +++ b/internal/devbox/services.go @@ -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() } diff --git a/internal/services/client.go b/internal/services/client.go index d33b9817cbe..cebee8b233b 100644 --- a/internal/services/client.go +++ b/internal/services/client.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "net/http" + "time" "github.com/f1bonacc1/process-compose/src/types" ) @@ -17,9 +18,14 @@ import ( 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 { @@ -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