Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Standardize column spacing in output
Browse files Browse the repository at this point in the history
Standardizes the column spacing when writing tables to the output to have the same width and padding as with standard docker CLI commands
Includes both Docker App and invocation image outputs

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
  • Loading branch information
zappy-shu committed Nov 29, 2019
1 parent e18898a commit 0c20457
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cmd/cnab-run/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func runningServices(cli command.Cli, instanceName string) ([]swarmtypes.Service
}

func printServices(out io.Writer, services []swarmtypes.Service) error {
w := tabwriter.NewWriter(out, 0, 0, 1, ' ', 0)
w := tabwriter.NewWriter(out, 20, 2, 3, ' ', 0)
printHeaders(w)

for _, service := range services {
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func runList(dockerCli command.Cli, opts listOptions, installerContext *cliopts.
return tmpl.Execute(dockerCli.Out(), installations)
}

w := tabwriter.NewWriter(dockerCli.Out(), 0, 0, 1, ' ', 0)
w := tabwriter.NewWriter(dockerCli.Out(), 20, 1, 3, ' ', 0)
printHeaders(w)

for _, installation := range installations {
Expand Down
2 changes: 1 addition & 1 deletion internal/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func printSection(out io.Writer, len int, printer func(io.Writer), headers ...st
return
}
fmt.Fprintln(out)
w := tabwriter.NewWriter(out, 0, 0, 1, ' ', 0)
w := tabwriter.NewWriter(out, 20, 1, 3, ' ', 0)
fmt.Fprintln(w, strings.Join(headers, "\t"))
printer(w)
w.Flush()
Expand Down
26 changes: 13 additions & 13 deletions internal/inspect/testdata/inspect-bundle-pretty.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ maintainers:
email: dev2@example.com


SERVICE IMAGE
app-watcher watcher
debug busybox:latest
front nginx
monitor busybox:latest
SERVICE IMAGE
app-watcher watcher
debug busybox:latest
front nginx
monitor busybox:latest

PARAMETER VALUE
com.docker.app.args
com.docker.app.inspect-format json
com.docker.app.kubernetes-namespace
com.docker.app.orchestrator
com.docker.app.render-format yaml
com.docker.app.share-registry-creds false
watcher.cmd foo
PARAMETER VALUE
com.docker.app.args
com.docker.app.inspect-format json
com.docker.app.kubernetes-namespace
com.docker.app.orchestrator
com.docker.app.render-format yaml
com.docker.app.share-registry-creds false
watcher.cmd foo
16 changes: 8 additions & 8 deletions internal/inspect/testdata/inspect-full.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ maintainers:
email: dev@example.com


SERVICE REPLICAS PORTS IMAGE
web1 2 8080-8100 nginx:latest
web2 2 9080-9100 nginx:latest
SERVICE REPLICAS PORTS IMAGE
web1 2 8080-8100 nginx:latest
web2 2 9080-9100 nginx:latest

NETWORK
my-network1
Expand All @@ -22,9 +22,9 @@ SECRET
my-secret1
my-secret2

PARAMETER VALUE
port 8080
text hello
PARAMETER VALUE
port 8080
text hello

ATTACHMENT SIZE
config.cfg 9B
ATTACHMENT SIZE
config.cfg 9B
8 changes: 4 additions & 4 deletions internal/inspect/testdata/inspect-overridden.golden
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: ""
maintainers: []


SERVICE REPLICAS PORTS IMAGE
web 1 80 nginx
SERVICE REPLICAS PORTS IMAGE
web 1 80 nginx

PARAMETER VALUE
web.port 80
PARAMETER VALUE
web.port 80

0 comments on commit 0c20457

Please sign in to comment.