Skip to content

Commit 5baa0f8

Browse files
committed
compose top: reduce tabwriter padding
Signed-off-by: Dominik Menke <[email protected]>
1 parent 33a819e commit 5baa0f8

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

cmd/compose/top.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func topPrint(out io.Writer, headers topHeader, rows []topEntries) error {
124124
return nil
125125
}
126126

127-
w := tabwriter.NewWriter(out, 5, 1, 3, ' ', 0)
127+
w := tabwriter.NewWriter(out, 4, 1, 2, ' ', 0)
128128

129129
// write headers in the order we've encountered them
130130
h := make([]string, len(headers))

cmd/compose/top_test.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ var topTestCases = []struct {
7474
},
7575
},
7676
output: trim(`
77-
SERVICE # UID PID PPID C STIME TTY TIME CMD
78-
simple 1 root 1 1 0 12:00 ? 00:00:01 /entrypoint
77+
SERVICE # UID PID PPID C STIME TTY TIME CMD
78+
simple 1 root 1 1 0 12:00 ? 00:00:01 /entrypoint
7979
`),
8080
},
8181
{
@@ -107,8 +107,8 @@ var topTestCases = []struct {
107107
},
108108
},
109109
output: trim(`
110-
SERVICE # UID PID C STIME TTY TIME CMD
111-
noppid 1 root 1 0 12:00 ? 00:00:02 /entrypoint
110+
SERVICE # UID PID C STIME TTY TIME CMD
111+
noppid 1 root 1 0 12:00 ? 00:00:02 /entrypoint
112112
`),
113113
},
114114
{
@@ -144,8 +144,8 @@ var topTestCases = []struct {
144144
},
145145
},
146146
output: trim(`
147-
SERVICE # UID GID PID PPID C STIME TTY TIME CMD
148-
extra-hdr 1 root 1 1 1 0 12:00 ? 00:00:03 /entrypoint
147+
SERVICE # UID GID PID PPID C STIME TTY TIME CMD
148+
extra-hdr 1 root 1 1 1 0 12:00 ? 00:00:03 /entrypoint
149149
`),
150150
},
151151
{
@@ -194,9 +194,9 @@ var topTestCases = []struct {
194194
},
195195
},
196196
output: trim(`
197-
SERVICE # UID PID PPID C STIME TTY TIME CMD
198-
multiple 1 root 1 1 0 12:00 ? 00:00:04 /entrypoint
199-
multiple 1 root 123 1 0 12:00 ? 00:00:42 sleep infinity
197+
SERVICE # UID PID PPID C STIME TTY TIME CMD
198+
multiple 1 root 1 1 0 12:00 ? 00:00:04 /entrypoint
199+
multiple 1 root 123 1 0 12:00 ? 00:00:42 sleep infinity
200200
`),
201201
},
202202
}
@@ -311,12 +311,12 @@ func TestRunTopCore(t *testing.T) {
311311
err := topPrint(&buf, header, entries)
312312
require.NoError(t, err)
313313
assert.Equal(t, trim(`
314-
SERVICE # UID PID PPID C STIME TTY TIME GID CMD
315-
simple 1 root 1 1 0 12:00 ? 00:00:01 - /entrypoint
316-
noppid 1 root 1 - 0 12:00 ? 00:00:02 - /entrypoint
317-
extra-hdr 1 root 1 1 0 12:00 ? 00:00:03 1 /entrypoint
318-
multiple 1 root 1 1 0 12:00 ? 00:00:04 - /entrypoint
319-
multiple 1 root 123 1 0 12:00 ? 00:00:42 - sleep infinity
314+
SERVICE # UID PID PPID C STIME TTY TIME GID CMD
315+
simple 1 root 1 1 0 12:00 ? 00:00:01 - /entrypoint
316+
noppid 1 root 1 - 0 12:00 ? 00:00:02 - /entrypoint
317+
extra-hdr 1 root 1 1 0 12:00 ? 00:00:03 1 /entrypoint
318+
multiple 1 root 1 1 0 12:00 ? 00:00:04 - /entrypoint
319+
multiple 1 root 123 1 0 12:00 ? 00:00:42 - sleep infinity
320320
`), buf.String())
321321

322322
})

0 commit comments

Comments
 (0)