From c686492998aac2933345a8989ba10a7c666296fd Mon Sep 17 00:00:00 2001 From: vilmibm Date: Tue, 9 Jun 2020 04:36:29 +0000 Subject: [PATCH] support Maintainer field --- main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index adc6bd5..0c119f8 100644 --- a/main.go +++ b/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 }