mirror of
https://github.com/cheat/cheat.git
synced 2024-12-18 10:45:05 +01:00
e5114a3e76
- Re-implemented the project in Golang, and deprecated Python entirely - Implemented several new, long-requested features - Refactored cheatsheets into a separate repository
29 lines
554 B
Go
29 lines
554 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"text/tabwriter"
|
|
|
|
"github.com/cheat/cheat/internal/config"
|
|
)
|
|
|
|
// cmdDirectories lists the configured cheatpaths.
|
|
func cmdDirectories(opts map[string]interface{}, conf config.Config) {
|
|
|
|
// initialize a tabwriter to produce cleanly columnized output
|
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
|
|
|
|
// generate sorted, columnized output
|
|
for _, path := range conf.Cheatpaths {
|
|
fmt.Fprintln(w, fmt.Sprintf(
|
|
"%s:\t%s",
|
|
path.Name,
|
|
path.Path,
|
|
))
|
|
}
|
|
|
|
// write columnized output to stdout
|
|
w.Flush()
|
|
}
|