mirror of
https://github.com/docker/compose.git
synced 2025-07-22 13:14:29 +02:00
error check
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
64c517f375
commit
00f17534a3
@ -61,17 +61,17 @@ func runPs(ctx context.Context, opts cli.ProjectOptions) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
printSection(os.Stdout, func(w io.Writer) {
|
err = printSection(os.Stdout, func(w io.Writer) {
|
||||||
for _, service := range serviceList {
|
for _, service := range serviceList {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%d/%d\t%s\n", service.ID, service.Name, service.Replicas, service.Desired, strings.Join(service.Ports, ", "))
|
fmt.Fprintf(w, "%s\t%s\t%d/%d\t%s\n", service.ID, service.Name, service.Replicas, service.Desired, strings.Join(service.Ports, ", "))
|
||||||
}
|
}
|
||||||
}, "ID", "NAME", "REPLICAS", "PORTS")
|
}, "ID", "NAME", "REPLICAS", "PORTS")
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func printSection(out io.Writer, printer func(io.Writer), headers ...string) {
|
func printSection(out io.Writer, printer func(io.Writer), headers ...string) error {
|
||||||
w := tabwriter.NewWriter(out, 20, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(out, 20, 1, 3, ' ', 0)
|
||||||
fmt.Fprintln(w, strings.Join(headers, "\t"))
|
fmt.Fprintln(w, strings.Join(headers, "\t"))
|
||||||
printer(w)
|
printer(w)
|
||||||
w.Flush()
|
return w.Flush()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user