apply

package
v0.0.75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package apply provides the apply command for the minder CLI

Index

Constants

This section is empty.

Variables

View Source
var DocsCmd = &cobra.Command{
	Use:   "docs",
	Short: "Generates documentation for the client",
	Long:  `Generates documentation for the client.`,
	PreRunE: func(cmd *cobra.Command, _ []string) error {
		if err := viper.BindPFlags(cmd.Flags()); err != nil {
			return cli.MessageAndError("Error binding flags", err)
		}
		return nil
	},
	RunE: func(_ *cobra.Command, _ []string) error {

		app.RootCmd.DisableAutoGenTag = true

		prefix := func(filename string) string {

			filename = filepath.Base(filename)
			cmdString := strings.ReplaceAll(strings.TrimSuffix(filename, ".md"), "_", " ")
			return fmt.Sprintf("---\ntitle: %s\n---\n", cmdString)
		}
		identity := func(s string) string { return s }

		configHelpFile, err := os.Create("./docs/docs/ref/cli/minder_config.md")
		if err != nil {
			return fmt.Errorf("Unable to open file for config docs: %w", err)
		}
		if _, err := configHelpFile.WriteString("---\ntitle: minder config\n---\n"); err != nil {
			return fmt.Errorf("Unable to write docs header: %w", err)
		}
		if err := doc.GenMarkdown(app.ConfigHelpCmd, configHelpFile); err != nil {
			return fmt.Errorf("Unable to write markdown for config help: %w", err)
		}
		return doc.GenMarkdownTreeCustom(app.RootCmd, "./docs/docs/ref/cli", prefix, identity)
	},
}

DocsCmd generates documentation

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL