cmdbuilder

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocsDirectory = "./docs"

DocsDirectory is the fallback location for markdown documentation files

Functions

func FindDocFile added in v0.3.6

func FindDocFile(cmd *cobra.Command) (string, error)

FindDocFile locates the markdown file for a specific command

func RegisterEmbeddedDocs added in v0.3.6

func RegisterEmbeddedDocs(docs embed.FS)

RegisterEmbeddedDocs registers the embedded documentation filesystem

func RenderDocFile added in v0.3.6

func RenderDocFile(filePath string) (string, error)

RenderDocFile reads and renders a markdown file using Glamour

func ShowDocumentation added in v0.3.6

func ShowDocumentation(cmd *cobra.Command) error

ShowDocumentation displays rendered documentation for a command

Types

type CommandBuilder

type CommandBuilder struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(use, short string) *CommandBuilder

NewCommand creates a new command builder with minimal required fields

func (*CommandBuilder) Build

func (b *CommandBuilder) Build() *cobra.Command

Build constructs and returns the final command

func (*CommandBuilder) ReflagCmd

func (b *CommandBuilder) ReflagCmd(requiredFlags ...string) *CommandBuilder

ReflagCmd explicitly marks flags as required after they have been added

func (*CommandBuilder) WithArgs

WithArgs sets the positional arguments validator for the command

func (*CommandBuilder) WithBoolFlag

func (b *CommandBuilder) WithBoolFlag(name string, defaultVal bool, usage string) *CommandBuilder

WithBoolFlag adds a boolean flag to the command

func (*CommandBuilder) WithBoolFlagP

func (b *CommandBuilder) WithBoolFlagP(name, shorthand string, defaultVal bool, usage string) *CommandBuilder

WithBoolFlag adds a boolean flag to the command

func (*CommandBuilder) WithColorAwareRunFunc

func (b *CommandBuilder) WithColorAwareRunFunc(f func(*cobra.Command, []string, bool) error) *CommandBuilder

WithColorAwareRunFunc wraps the run function with color awareness

func (*CommandBuilder) WithConditionalRequirements

func (b *CommandBuilder) WithConditionalRequirements(conditionallyRequiredFlags ...string) *CommandBuilder

func (*CommandBuilder) WithDateRangeFlags

func (b *CommandBuilder) WithDateRangeFlags() *CommandBuilder

WithDateRangeFlags adds start and end date flags for time-bound resources

func (*CommandBuilder) WithDeleteFlags

func (b *CommandBuilder) WithDeleteFlags() *CommandBuilder

WithMCRDeleteFlags adds flags for deletion

func (*CommandBuilder) WithDocumentation added in v0.3.6

func (b *CommandBuilder) WithDocumentation() *CommandBuilder

WithDocumentation adds a 'docs' subcommand that shows rendered markdown documentation

func (*CommandBuilder) WithDocumentedRequiredFlag

func (b *CommandBuilder) WithDocumentedRequiredFlag(name, description string) *CommandBuilder

WithDocumentedRequiredFlag documents a flag as required without marking it required in Cobra

func (*CommandBuilder) WithExample

func (b *CommandBuilder) WithExample(example string) *CommandBuilder

WithExample adds an example to the command's documentation

func (*CommandBuilder) WithFlag

func (b *CommandBuilder) WithFlag(name, defaultVal, usage string) *CommandBuilder

WithFlag adds a standard string flag to the command

func (*CommandBuilder) WithFlagCompletionFunc

func (b *CommandBuilder) WithFlagCompletionFunc(flagName string, f func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)) *CommandBuilder

WithFlagCompletionFunc adds completion for a specific flag

func (*CommandBuilder) WithFlagP

func (b *CommandBuilder) WithFlagP(name, shorthand, defaultVal, usage string) *CommandBuilder

WithFlagP adds a standard string flag with a shorthand to the command

func (*CommandBuilder) WithImportantNote

func (b *CommandBuilder) WithImportantNote(note string) *CommandBuilder

WithImportantNote adds an important note to the command's documentation

func (*CommandBuilder) WithIntFlag

func (b *CommandBuilder) WithIntFlag(name string, defaultVal int, usage string) *CommandBuilder

WithIntFlag adds an integer flag to the command

func (*CommandBuilder) WithIntFlagP

func (b *CommandBuilder) WithIntFlagP(name, shorthand string, defaultVal int, usage string) *CommandBuilder

WithIntFlagP adds an integer flag with a shorthand to the command

func (*CommandBuilder) WithInteractiveFlag

func (b *CommandBuilder) WithInteractiveFlag() *CommandBuilder

WithInteractiveFlag adds just the interactive flag

func (*CommandBuilder) WithJSONConfigFlags

func (b *CommandBuilder) WithJSONConfigFlags() *CommandBuilder

WithJSONConfigFlags adds flags for JSON configuration input

func (*CommandBuilder) WithJSONExample

func (b *CommandBuilder) WithJSONExample(example string) *CommandBuilder

WithJsonExample adds a JSON example to the command's documentation

func (*CommandBuilder) WithLocationsFilterFlags

func (b *CommandBuilder) WithLocationsFilterFlags() *CommandBuilder

WithLocationsFilterFlags adds common location filter flags

func (*CommandBuilder) WithLongDesc

func (b *CommandBuilder) WithLongDesc(desc string) *CommandBuilder

WithLongDesc sets the long description for the command

func (*CommandBuilder) WithMCRCreateFlags

func (b *CommandBuilder) WithMCRCreateFlags() *CommandBuilder

WithMCRCreateFlags adds flags for MCR creation

func (*CommandBuilder) WithMCRPrefixFilterListFlags

func (b *CommandBuilder) WithMCRPrefixFilterListFlags() *CommandBuilder

WithMCRPrefixFilterListFlags adds flags for managing MCR prefix filter lists

func (*CommandBuilder) WithMCRUpdateFlags

func (b *CommandBuilder) WithMCRUpdateFlags() *CommandBuilder

WithMCRUpdateFlags adds flags for MCR updates

func (*CommandBuilder) WithMVECommonFlags

func (b *CommandBuilder) WithMVECommonFlags() *CommandBuilder

WithMVECommonFlags adds common flags for MVE operations

func (*CommandBuilder) WithMVECreateFlags

func (b *CommandBuilder) WithMVECreateFlags() *CommandBuilder

WithMVECreateFlags adds flags needed for MVE creation

func (*CommandBuilder) WithMVEImageFilterFlags

func (b *CommandBuilder) WithMVEImageFilterFlags() *CommandBuilder

WithMVEImageFilterFlags adds flags for filtering MVE images

func (*CommandBuilder) WithMVEUpdateFlags

func (b *CommandBuilder) WithMVEUpdateFlags() *CommandBuilder

WithMVEUpdateFlags adds flags for updating an MVE

func (*CommandBuilder) WithOptionalFlag

func (b *CommandBuilder) WithOptionalFlag(name, desc string) *CommandBuilder

WithOptionalFlag adds documentation for an optional flag

func (*CommandBuilder) WithOutputFormatRunFunc

func (b *CommandBuilder) WithOutputFormatRunFunc(f func(*cobra.Command, []string, bool, string) error) *CommandBuilder

WithOutputFormatRunFunc wraps the run function with output formatting

func (*CommandBuilder) WithPartnerFilterFlags

func (b *CommandBuilder) WithPartnerFilterFlags() *CommandBuilder

WithPartnerFilterFlags adds common partner filter flags

func (*CommandBuilder) WithPortCommonFlags

func (b *CommandBuilder) WithPortCommonFlags() *CommandBuilder

WithPortCommonFlags adds common flags for port operations

func (*CommandBuilder) WithPortCreationFlags

func (b *CommandBuilder) WithPortCreationFlags() *CommandBuilder

WithPortCreationFlags adds flags needed for port creation without marking them required

func (*CommandBuilder) WithPortFilterFlags

func (b *CommandBuilder) WithPortFilterFlags() *CommandBuilder

WithPortFilterFlags adds flags for filtering port lists

func (*CommandBuilder) WithPortLAGFlags

func (b *CommandBuilder) WithPortLAGFlags() *CommandBuilder

WithPortLAGFlags adds flags specific to LAG port operations

func (*CommandBuilder) WithPortUpdateFlags

func (b *CommandBuilder) WithPortUpdateFlags() *CommandBuilder

WithPortUpdateFlags adds flags needed for port updates

func (*CommandBuilder) WithRequiredFlag

func (b *CommandBuilder) WithRequiredFlag(name, description string) *CommandBuilder

WithRequiredFlag marks a flag as required and adds description

func (*CommandBuilder) WithResourceIdentificationFlags

func (b *CommandBuilder) WithResourceIdentificationFlags() *CommandBuilder

WithResourceIdentificationFlags adds UID and name flags for resource identification

func (*CommandBuilder) WithRootCmd

func (b *CommandBuilder) WithRootCmd(rootCmd *cobra.Command) *CommandBuilder

WithRootCmd sets the root command for help generation

func (*CommandBuilder) WithRunFunc

func (b *CommandBuilder) WithRunFunc(f func(*cobra.Command, []string) error) *CommandBuilder

WithRunFunc sets the command's run function

func (*CommandBuilder) WithServiceKeyCommonFlags

func (b *CommandBuilder) WithServiceKeyCommonFlags() *CommandBuilder

WithServiceKeyCommonFlags adds common flags for service key operations

func (*CommandBuilder) WithServiceKeyCreateFlags

func (b *CommandBuilder) WithServiceKeyCreateFlags() *CommandBuilder

WithServiceKeyCreateFlags adds all flags needed for service key creation

func (*CommandBuilder) WithServiceKeyUpdateFlags

func (b *CommandBuilder) WithServiceKeyUpdateFlags() *CommandBuilder

WithServiceKeyUpdateFlags adds flags for updating a service key

func (*CommandBuilder) WithStandardInputFlags

func (b *CommandBuilder) WithStandardInputFlags() *CommandBuilder

AddStandardInputFlags adds interactive, json and json-file flags

func (*CommandBuilder) WithStatusFilterFlags

func (b *CommandBuilder) WithStatusFilterFlags() *CommandBuilder

WithStatusFilterFlags adds flags for filtering resources by status

func (*CommandBuilder) WithTimeRangeFilterFlags

func (b *CommandBuilder) WithTimeRangeFilterFlags() *CommandBuilder

WithTimeRangeFilterFlags adds flags for filtering resources by time range

func (*CommandBuilder) WithVXCCommonFlags

func (b *CommandBuilder) WithVXCCommonFlags() *CommandBuilder

WithVXCCommonFlags adds common flags for VXC operations

func (*CommandBuilder) WithVXCCreateFlags

func (b *CommandBuilder) WithVXCCreateFlags() *CommandBuilder

WithVXCCreateFlags adds all flags needed for VXC creation

func (*CommandBuilder) WithVXCEndpointFlags

func (b *CommandBuilder) WithVXCEndpointFlags() *CommandBuilder

WithVXCEndpointFlags adds endpoint-related flags for VXC operations

func (*CommandBuilder) WithVXCPartnerConfigFlags

func (b *CommandBuilder) WithVXCPartnerConfigFlags() *CommandBuilder

WithVXCPartnerConfigFlags adds partner configuration flags for VXCs

func (*CommandBuilder) WithVXCUpdateFlags

func (b *CommandBuilder) WithVXCUpdateFlags() *CommandBuilder

WithVXCUpdateFlags adds all flags needed for VXC updates

func (*CommandBuilder) WithValidArgs

func (b *CommandBuilder) WithValidArgs(validArgs []string) *CommandBuilder

WithValidArgs adds a list of valid arguments that are displayed in completion

func (*CommandBuilder) WithValidArgsFunction

func (b *CommandBuilder) WithValidArgsFunction(f func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)) *CommandBuilder

WithValidArgsFunction adds a function to validate and generate completion for arguments

Jump to

Keyboard shortcuts

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