Documentation
¶
Index ¶
- func NewCommand(use string, runE func(cmd *cobra.Command, args []string) error) *cobra.Command
- func NoColorAdapter(fn func(cmd *cobra.Command, args []string, noColor bool) error) func(cmd *cobra.Command, args []string) error
- func OutputAdapter(...) func(cmd *cobra.Command, args []string) error
- func SetFlags(t *testing.T, cmd *cobra.Command, flags map[string]string)
- func SetupLogin(setupFn func(*megaport.Client)) func()
- func SetupLoginError(err error) func()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
NewCommand creates a cobra.Command with the given use string and RunE, pre-configured with the --output flag defaulting to "table".
func NoColorAdapter ¶
func NoColorAdapter(fn func(cmd *cobra.Command, args []string, noColor bool) error) func(cmd *cobra.Command, args []string) error
NoColorAdapter wraps a function that takes (cmd, args, noColor) into a standard cobra RunE, always passing noColor=true for tests.
func OutputAdapter ¶
func OutputAdapter(fn func(cmd *cobra.Command, args []string, noColor bool, outputFormat string) error) func(cmd *cobra.Command, args []string) error
OutputAdapter wraps a function that takes (cmd, args, noColor, outputFormat) into a standard cobra RunE. It reads --output from the command flags, defaulting to "table".
func SetFlags ¶
SetFlags sets multiple string flag values on a command, calling t.Fatalf on any error.
func SetupLogin ¶
SetupLogin saves the current login function, replaces it with one that returns a client configured by setupFn, and returns a cleanup function that restores the original.
func SetupLoginError ¶
func SetupLoginError(err error) func()
SetupLoginError saves the current login function, replaces it with one that returns the given error, and returns a cleanup function.
Types ¶
This section is empty.