cmdbuilder

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MPL-2.0 Imports: 13 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) WithAliases added in v0.5.7

func (b *CommandBuilder) WithAliases(aliases []string) *CommandBuilder

WithAliases sets command aliases for shorthand access

func (*CommandBuilder) WithArgs

WithArgs sets the positional arguments validator for the command

func (*CommandBuilder) WithBillingMarketSetFlags added in v0.5.1

func (b *CommandBuilder) WithBillingMarketSetFlags() *CommandBuilder

WithBillingMarketSetFlags adds all flags needed for setting a billing market

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) WithBuyConfirmFlags added in v0.5.4

func (b *CommandBuilder) WithBuyConfirmFlags() *CommandBuilder

WithBuyConfirmFlags adds the --yes/-y flag to skip buy confirmation prompts

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) WithDeferredDeleteFlags added in v0.11.0

func (b *CommandBuilder) WithDeferredDeleteFlags() *CommandBuilder

WithDeferredDeleteFlags adds delete flags for resources where immediate deletion is the default and deferred end-of-term cancellation is opt-in via --later. Used by VXC and IX, which are the only product types whose API still accepts CANCEL (end-of-term).

func (*CommandBuilder) WithDeleteFlags

func (b *CommandBuilder) WithDeleteFlags() *CommandBuilder

WithDeleteFlags adds flags for deletion

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) WithDurationFlag added in v0.5.8

func (b *CommandBuilder) WithDurationFlag(name string, defaultVal time.Duration, usage string) *CommandBuilder

WithDurationFlag adds a duration flag to the command

func (*CommandBuilder) WithDurationFlagP added in v0.5.8

func (b *CommandBuilder) WithDurationFlagP(name, shorthand string, defaultVal time.Duration, usage string) *CommandBuilder

WithDurationFlagP adds a duration flag with a shorthand to the command

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) WithIXCreateFlags added in v0.5.0

func (b *CommandBuilder) WithIXCreateFlags() *CommandBuilder

WithIXCreateFlags adds flags for IX creation

func (*CommandBuilder) WithIXFilterFlags added in v0.5.0

func (b *CommandBuilder) WithIXFilterFlags() *CommandBuilder

WithIXFilterFlags adds flags for filtering IX lists

func (*CommandBuilder) WithIXUpdateFlags added in v0.5.0

func (b *CommandBuilder) WithIXUpdateFlags() *CommandBuilder

WithIXUpdateFlags adds flags for IX updates

func (*CommandBuilder) WithImmediateDeleteFlags added in v0.11.0

func (b *CommandBuilder) WithImmediateDeleteFlags() *CommandBuilder

WithImmediateDeleteFlags adds delete flags for resources that only support immediate deletion (no --now flag), without safe-delete support.

func (*CommandBuilder) WithImmediateSafeDeleteFlags added in v0.11.0

func (b *CommandBuilder) WithImmediateSafeDeleteFlags() *CommandBuilder

WithImmediateSafeDeleteFlags adds delete flags for resources that only support immediate deletion (no --now flag), with safe-delete support.

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) WithMCRFilterFlags added in v0.3.9

func (b *CommandBuilder) WithMCRFilterFlags() *CommandBuilder

WithMCRFilterFlags adds flags for filtering MCR lists

func (*CommandBuilder) WithMCRIPSecAddOnFlags added in v0.7.1

func (b *CommandBuilder) WithMCRIPSecAddOnFlags() *CommandBuilder

WithMCRIPSecAddOnFlags adds flags for adding an IPSec add-on to an MCR.

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) WithMCRUpdateIPSecAddOnFlags added in v0.7.1

func (b *CommandBuilder) WithMCRUpdateIPSecAddOnFlags() *CommandBuilder

WithMCRUpdateIPSecAddOnFlags adds flags for updating an IPSec add-on on an MCR.

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) WithMVEFilterFlags added in v0.3.9

func (b *CommandBuilder) WithMVEFilterFlags() *CommandBuilder

WithMVEFilterFlags adds flags for filtering MVE lists

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) WithManagedAccountCreateFlags added in v0.5.0

func (b *CommandBuilder) WithManagedAccountCreateFlags() *CommandBuilder

WithManagedAccountCreateFlags adds flags for managed account creation

func (*CommandBuilder) WithManagedAccountFilterFlags added in v0.5.0

func (b *CommandBuilder) WithManagedAccountFilterFlags() *CommandBuilder

WithManagedAccountFilterFlags adds flags for filtering managed account lists

func (*CommandBuilder) WithManagedAccountUpdateFlags added in v0.5.0

func (b *CommandBuilder) WithManagedAccountUpdateFlags() *CommandBuilder

WithManagedAccountUpdateFlags adds flags for managed account updates

func (*CommandBuilder) WithNATGatewayCreateFlags added in v0.8.0

func (b *CommandBuilder) WithNATGatewayCreateFlags() *CommandBuilder

WithNATGatewayCreateFlags adds flags for NAT Gateway creation.

func (*CommandBuilder) WithNATGatewayFilterFlags added in v0.8.0

func (b *CommandBuilder) WithNATGatewayFilterFlags() *CommandBuilder

WithNATGatewayFilterFlags adds flags for filtering NAT Gateway lists.

func (*CommandBuilder) WithNATGatewayTelemetryFlags added in v0.8.0

func (b *CommandBuilder) WithNATGatewayTelemetryFlags() *CommandBuilder

WithNATGatewayTelemetryFlags adds flags for the NAT Gateway telemetry command.

func (*CommandBuilder) WithNATGatewayUpdateFlags added in v0.8.0

func (b *CommandBuilder) WithNATGatewayUpdateFlags() *CommandBuilder

WithNATGatewayUpdateFlags adds flags for NAT Gateway updates.

func (*CommandBuilder) WithNoWaitFlag added in v0.5.4

func (b *CommandBuilder) WithNoWaitFlag() *CommandBuilder

WithNoWaitFlag adds a flag to skip waiting for provisioning

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) WithResourceTagFlags added in v0.4.3

func (b *CommandBuilder) WithResourceTagFlags() *CommandBuilder

WithResourceTagFlags adds flags for resource tagging

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) WithSafeDeleteFlags added in v0.5.1

func (b *CommandBuilder) WithSafeDeleteFlags() *CommandBuilder

WithSafeDeleteFlags adds flags for deletion with safe-delete support (for resources that support it via the API)

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) WithServiceKeyListFlags added in v0.5.1

func (b *CommandBuilder) WithServiceKeyListFlags() *CommandBuilder

WithServiceKeyListFlags adds flags for listing service keys

func (*CommandBuilder) WithServiceKeyUpdateFlags

func (b *CommandBuilder) WithServiceKeyUpdateFlags() *CommandBuilder

WithServiceKeyUpdateFlags adds flags for updating a service key. No description flag: the update API does not support it.

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) WithStringArrayFlag added in v0.9.0

func (b *CommandBuilder) WithStringArrayFlag(name, usage string) *CommandBuilder

WithStringArrayFlag adds a repeatable string flag (each --flag value is a separate element). Unlike StringSlice, StringArray does not split on commas.

func (*CommandBuilder) WithTagFilterFlags added in v0.9.0

func (b *CommandBuilder) WithTagFilterFlags() *CommandBuilder

WithTagFilterFlags adds the --tag repeatable flag for filtering list results by resource tag. Format: --tag key=value (exact match) or --tag key (key-exists match). Multiple --tag flags are AND-ed together.

func (*CommandBuilder) WithTimeRangeFilterFlags

func (b *CommandBuilder) WithTimeRangeFilterFlags() *CommandBuilder

WithTimeRangeFilterFlags adds flags for filtering resources by time range

func (*CommandBuilder) WithUserCreateFlags added in v0.5.4

func (b *CommandBuilder) WithUserCreateFlags() *CommandBuilder

WithUserCreateFlags adds flags for user creation

func (*CommandBuilder) WithUserFilterFlags added in v0.5.4

func (b *CommandBuilder) WithUserFilterFlags() *CommandBuilder

WithUserFilterFlags adds flags for filtering user lists

func (*CommandBuilder) WithUserUpdateFlags added in v0.5.4

func (b *CommandBuilder) WithUserUpdateFlags() *CommandBuilder

WithUserUpdateFlags adds flags for user updates

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) WithVXCFilterFlags added in v0.5.0

func (b *CommandBuilder) WithVXCFilterFlags() *CommandBuilder

WithVXCFilterFlags adds flags for filtering VXC lists

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

func (*CommandBuilder) WithWatchFlags added in v0.5.8

func (b *CommandBuilder) WithWatchFlags() *CommandBuilder

WithWatchFlags adds flags for continuous status monitoring

Jump to

Keyboard shortcuts

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