cmdDirectories lists the configured cheatpaths.
(_ *cobra.Command, _ []string, conf config.Config)
| 13 | |
| 14 | // cmdDirectories lists the configured cheatpaths. |
| 15 | func 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 | } |