diff --git a/doc/yaml_docs.go b/doc/yaml_docs.go index a79fa40..3069b4e 100644 --- a/doc/yaml_docs.go +++ b/doc/yaml_docs.go @@ -128,7 +128,7 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { continue } - result = append(result, child.Name()+" - "+child.Short) + result = append(result, child.CommandPath()+" - "+child.Short) } yamlDoc.SeeAlso = result } diff --git a/doc/yaml_docs_test.go b/doc/yaml_docs_test.go index d08fa4f..9bf5aa6 100644 --- a/doc/yaml_docs_test.go +++ b/doc/yaml_docs_test.go @@ -2,6 +2,7 @@ package doc import ( "bytes" + "fmt" "io/ioutil" "os" "path/filepath" @@ -24,6 +25,7 @@ func TestGenYamlDoc(t *testing.T) { checkStringContains(t, output, "rootflag") checkStringContains(t, output, rootCmd.Short) checkStringContains(t, output, echoSubCmd.Short) + checkStringContains(t, output, fmt.Sprintf("- %s - %s", echoSubCmd.CommandPath(), echoSubCmd.Short)) } func TestGenYamlNoTag(t *testing.T) {