MCPcopy Index your code
hub / github.com/cli/cli / writeTSV

Function writeTSV

pkg/cmd/repo/read-dir/read_dir.go:154–161  ·  view source on GitHub ↗

writeTSV writes a tab-separated listing for non-TTY output: type, name, octal mode, and raw byte size, with no header.

(io *iostreams.IOStreams, dir *repoDir)

Source from the content-addressed store, hash-verified

152// writeTSV writes a tab-separated listing for non-TTY output: type, name,
153// octal mode, and raw byte size, with no header.
154func writeTSV(io *iostreams.IOStreams, dir *repoDir) error {
155 var sb strings.Builder
156 for _, e := range dir.Entries {
157 fmt.Fprintf(&sb, "%s\t%s\t%s\t%d\n", e.Type, e.Name, e.modeOctal(), e.Size)
158 }
159 _, err := io.Out.Write([]byte(sb.String()))
160 return err
161}
162
163// writeTable writes the TTY listing as a TYPE/NAME/SIZE table. Names are colored
164// by entry type and directories and submodules show "-" since git reports no size

Callers 1

readDirRunFunction · 0.85

Calls 3

modeOctalMethod · 0.80
WriteMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected