Merge pull request #28029 from tealtail/27994-add-service-ls-truncate-opt

remove COMMAND column from `service ls` output. closes #27994
This commit is contained in:
Misty Stanley-Jones 2016-11-07 14:39:16 -08:00 committed by GitHub
commit 6780c318a3
1 changed files with 3 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package service
import ( import (
"fmt" "fmt"
"io" "io"
"strings"
"text/tabwriter" "text/tabwriter"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
@ -18,7 +17,7 @@ import (
) )
const ( const (
listItemFmt = "%s\t%s\t%s\t%s\t%s\n" listItemFmt = "%s\t%s\t%s\t%s\n"
) )
type listOptions struct { type listOptions struct {
@ -110,7 +109,7 @@ func printTable(out io.Writer, services []swarm.Service, running map[string]int)
// Ignore flushing errors // Ignore flushing errors
defer writer.Flush() defer writer.Flush()
fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "REPLICAS", "IMAGE", "COMMAND") fmt.Fprintf(writer, listItemFmt, "ID", "NAME", "REPLICAS", "IMAGE")
for _, service := range services { for _, service := range services {
replicas := "" replicas := ""
if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil { if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil {
@ -124,8 +123,7 @@ func printTable(out io.Writer, services []swarm.Service, running map[string]int)
stringid.TruncateID(service.ID), stringid.TruncateID(service.ID),
service.Spec.Name, service.Spec.Name,
replicas, replicas,
service.Spec.TaskTemplate.ContainerSpec.Image, service.Spec.TaskTemplate.ContainerSpec.Image)
strings.Join(service.Spec.TaskTemplate.ContainerSpec.Args, " "))
} }
} }