diff --git a/Makefile b/Makefile index 371779eb2..b3c789f6f 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ serve-docs: .PHONY: build-api-docs build-api-docs: - go run main.go docs api api/v1/*.go --output-file docs/api.md + go run main.go docs api/v1/*.go --output-file docs/api.md .PHONY: build-docs build-docs: diff --git a/cmd/docs.go b/cmd/docs.go index 95dadf2eb..c050c6692 100644 --- a/cmd/docs.go +++ b/cmd/docs.go @@ -32,10 +32,11 @@ import ( "github.com/spf13/cobra" ) -var APIDocs = &cobra.Command{ - Use: "api", - Short: "Generate docs ", - Args: cobra.MinimumNArgs(0), +var Docs = &cobra.Command{ + Use: "docs", + Short: "Generate docs ", + Hidden: true, + Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { printAPIDocs(args) }, @@ -44,7 +45,7 @@ var APIDocs = &cobra.Command{ var out string func init() { - APIDocs.Flags().StringVar(&out, "output-file", "API.md", "") + Docs.Flags().StringVar(&out, "output-file", "docs/API.md", "") } var ( diff --git a/cmd/root.go b/cmd/root.go index 08bb7bf0b..ad4556ada 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,6 @@ import ( "github.com/flanksource/canary-checker/pkg/runner" "github.com/flanksource/commons/logger" "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" "github.com/spf13/pflag" ) @@ -43,24 +42,6 @@ func init() { logger.BindFlags(Root.PersistentFlags()) Root.PersistentFlags().BoolVar(&exposeEnv, "expose-env", false, "Expose environment variables for use in all templates. Note this has serious security implications with untrusted canaries") - docs := &cobra.Command{ - Use: "docs", - Short: "generate documentation", - } - - docs.AddCommand(&cobra.Command{ - Use: "cli [PATH]", - Short: "generate CLI documentation", - Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { - err := doc.GenMarkdownTree(Root, args[0]) - if err != nil { - logger.Fatalf("error creating docs", err) - } - }, - }) - - Root.AddCommand(APIDocs) - Root.AddCommand(docs) + Root.AddCommand(Docs) Root.AddCommand(Run, Serve, Operator) }