INNER CODE UNIT · Go
main
loft-sh/loft · hack/gen-docs.go:31
func main() {
filePrepender := func(filename string) string {
name := filepath.Base(filename)
base := strings.TrimSuffix(name, path.Ext(name))
command := strings.Split(base, "_")
title := strings.Join(command, " ")
sidebarLabel := title
l := len(command)
if l > 1 {
matches, err := filepath.Glob(cliDocsDir + "/loft_" + command[1])
if err != nil {
log.Fatal(err)
}
if len(matches) > 2 {
sidebarLabel = command[l-1]
}