get.porter.sh/porter@v1.3.0/cmd/porter/docs.go (about) 1 package main 2 3 import ( 4 "get.porter.sh/porter/pkg/docs" 5 "get.porter.sh/porter/pkg/porter" 6 "github.com/spf13/cobra" 7 ) 8 9 func buildDocsCommand(p *porter.Porter) *cobra.Command { 10 opts := &docs.DocsOptions{} 11 12 cmd := &cobra.Command{ 13 Use: "docs", 14 Short: "Generate markdown docs", 15 Long: "Generate markdown docs for https://porter.sh/cli", 16 Hidden: true, 17 PreRunE: func(cmd *cobra.Command, args []string) error { 18 opts.RootCommand = cmd.Root() 19 return opts.Validate(p.Context) 20 }, 21 RunE: func(cmd *cobra.Command, args []string) error { 22 return docs.GenerateCliDocs(opts) 23 }, 24 } 25 26 cmd.Annotations = map[string]string{ 27 "group": "meta", 28 skipConfig: "", 29 } 30 31 flags := cmd.Flags() 32 flags.StringVarP(&opts.Destination, "dest", "d", docs.DefaultDestination, 33 "Destination directory") 34 35 return cmd 36 }