MCPcopy Create free account
hub / github.com/docker/cli / writePadding

Method writePadding

cli/command/formatter/tabwriter/tabwriter.go:278–296  ·  view source on GitHub ↗
(textw, cellw int, useTabs bool)

Source from the content-addressed store, hash-verified

276)
277
278func (b *Writer) writePadding(textw, cellw int, useTabs bool) {
279 if b.padbytes[0] == '\t' || useTabs {
280 // padding is done with tabs
281 if b.tabwidth == 0 {
282 return // tabs have no width - can't do any padding
283 }
284 // make cellw the smallest multiple of b.tabwidth
285 cellw = (cellw + b.tabwidth - 1) / b.tabwidth * b.tabwidth
286 n := cellw - textw // amount of padding
287 if n < 0 {
288 panic("internal error")
289 }
290 b.writeN(tabs, (n+b.tabwidth-1)/b.tabwidth)
291 return
292 }
293
294 // padding is done with non-tab characters
295 b.writeN(b.padbytes[0:], cellw-textw)
296}
297
298var vbar = []byte{'|'}
299

Callers 1

writeLinesMethod · 0.95

Calls 1

writeNMethod · 0.95

Tested by

no test coverage detected