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

Method Init

cli/command/formatter/tabwriter/tabwriter.go:213–233  ·  view source on GitHub ↗

A Writer must be initialized with a call to Init. The first parameter (output) specifies the filter output. The remaining parameters control the formatting: minwidth minimal cell width including any padding tabwidth width of tab characters (equivalent number of spaces) padding the padding added

(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint)

Source from the content-addressed store, hash-verified

211// to the tab width in the viewer displaying the result)
212// flags formatting control
213func (b *Writer) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer {
214 if minwidth < 0 || tabwidth < 0 || padding < 0 {
215 panic("negative minwidth, tabwidth, or padding")
216 }
217 b.output = output
218 b.minwidth = minwidth
219 b.tabwidth = tabwidth
220 b.padding = padding
221 for i := range b.padbytes {
222 b.padbytes[i] = padchar
223 }
224 if padchar == '\t' {
225 // tab padding enforces left-alignment
226 flags &^= AlignRight
227 }
228 b.flags = flags
229
230 b.reset()
231
232 return b
233}
234
235// debugging support (keep code around)
236func (b *Writer) dump() {

Callers 4

checkFunction · 0.95
NewWriterFunction · 0.80
TestPanicDuringFlushFunction · 0.80
TestPanicDuringWriteFunction · 0.80

Calls 1

resetMethod · 0.95

Tested by 3

checkFunction · 0.76
TestPanicDuringFlushFunction · 0.64
TestPanicDuringWriteFunction · 0.64