cmd

package
v0.0.0-...-1ac4089 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause-Clear Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RootConfigKey configKey = "example-config"

Variables

View Source
var AttributesExampleCmd = &cobra.Command{
	Use:   "attributes",
	Short: "Example usage for attributes service",
	RunE: func(cmd *cobra.Command, args []string) error {
		examplesConfig := *(cmd.Context().Value(RootConfigKey).(*ExampleConfig))
		return attributesExample(&examplesConfig)
	},
}
View Source
var AuthorizationExampleCmd = &cobra.Command{
	Use:   "authorization",
	Short: "Example usage for authorization service",
	RunE: func(cmd *cobra.Command, args []string) error {
		examplesConfig := *(cmd.Context().Value(RootConfigKey).(*ExampleConfig))
		return authorizationExamples(&examplesConfig)
	},
}
View Source
var ExamplesCmd = &cobra.Command{
	Use: "examples",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		platformEndpoint, err := cmd.Parent().PersistentFlags().GetString("platformEndpoint")
		if err != nil {
			return err
		}
		config := &ExampleConfig{
			PlatformEndpoint: platformEndpoint,
		}
		ctx := context.WithValue(cmd.Context(), RootConfigKey, config)
		cmd.SetContext(ctx)
		return nil
	},
}
View Source
var GenDocsCmd = &cobra.Command{
	Use:   "docs",
	Short: "Generates docs for the example commands",
	RunE: func(cmd *cobra.Command, args []string) error {
		println("Generating Docs")
		err := doc.GenMarkdownTree(ExamplesCmd, "./docs")
		return err
	},
}

Functions

func Execute

func Execute()

Types

type ExampleConfig

type ExampleConfig struct {
	PlatformEndpoint string
}

Jump to

Keyboard shortcuts

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