MCPcopy Index your code
hub / github.com/cheat/cheat / cmdDirectories

Function cmdDirectories

cmd/cheat/cmd_directories.go:15–29  ·  view source on GitHub ↗

cmdDirectories lists the configured cheatpaths.

(_ *cobra.Command, _ []string, conf config.Config)

Source from the content-addressed store, hash-verified

13
14// cmdDirectories lists the configured cheatpaths.
15func cmdDirectories(_ *cobra.Command, _ []string, conf config.Config) {
16
17 // initialize a tabwriter to produce cleanly columnized output
18 var out bytes.Buffer
19 w := tabwriter.NewWriter(&out, 0, 0, 1, ' ', 0)
20
21 // generate sorted, columnized output
22 for _, path := range conf.Cheatpaths {
23 fmt.Fprintf(w, "%s:\t%s\n", path.Name, path.Path)
24 }
25
26 // write columnized output to stdout
27 w.Flush()
28 display.Write(out.String(), conf)
29}

Callers 1

runFunction · 0.85

Calls 1

WriteFunction · 0.92

Tested by

no test coverage detected