support Maintainer field
parent
f685a9baa2
commit
c686492998
13
main.go
13
main.go
|
@ -75,20 +75,25 @@ func parseCommand(targetCmd *cobra.Command, yamlPath string) {
|
|||
_, err := os.Stat(executablePath)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not find matching executable for %s; skipping...", yamlPath)
|
||||
fmt.Fprintf(os.Stderr, "could not find matching executable for %s; skipping...\n", yamlPath)
|
||||
return
|
||||
}
|
||||
|
||||
yamlBytes, err := ioutil.ReadFile(yamlPath)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not read %s; skipping...", yamlPath)
|
||||
fmt.Fprintf(os.Stderr, "could not read %s; skipping...\n", yamlPath)
|
||||
return
|
||||
}
|
||||
|
||||
doc := commandDoc{}
|
||||
err = yaml.Unmarshal(yamlBytes, &doc)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not parse %s; skipping...", yamlPath)
|
||||
fmt.Fprintf(os.Stderr, "could not parse %s; skipping...\n", yamlPath)
|
||||
return
|
||||
}
|
||||
|
||||
if doc.Maintainer == "" {
|
||||
fmt.Fprintf(os.Stderr, "%s is missing maintainer field; skipping...\n", yamlPath)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -104,6 +109,8 @@ func parseCommand(targetCmd *cobra.Command, yamlPath string) {
|
|||
parsedCmd.Long = doc.LongDesc
|
||||
}
|
||||
|
||||
parsedCmd.Long += fmt.Sprintf("\nMaintained by %s; reach out to them via mail or chat with questions", doc.Maintainer)
|
||||
|
||||
if doc.Examples != "" {
|
||||
parsedCmd.Example = doc.Examples
|
||||
}
|
||||
|
|
Reference in New Issue