cmd

package
v0.0.0-...-13ec5d5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger *logs.Log
)

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ExecuteCmdWithArgsInTest

func ExecuteCmdWithArgsInTest(t *testing.T, cmd *cobra.Command, args ...string) (string, error)

ExecuteCmdWithArgsInTest is a wrapper to facilitate calling cobra.Command structs, in which arguments are passed to the Command struct and any potential output from those commands is captured to then be returned. This function **does not wrap os.Stdout nor os.Stderr**. To perform assertions over os.Stdout use ExecuteCmdWithPipes.

func ExecuteCmdWithStdinPipe

func ExecuteCmdWithStdinPipe(t *testing.T, cmd *cobra.Command, toStdin string, args ...string) (string, error)

func ExecuteCmdWithStdoutPipe

func ExecuteCmdWithStdoutPipe(t *testing.T, cmd *cobra.Command, args ...string) (string, error)

ExecuteCmdWithStdoutPipe is a wrapper to facilitate calling cobra.Command structs, in which arguments are passed to the Command struct, but in this function os.Stdout is captured and returned to the caller. This function **wraps os.Stdout** but not os.Stderr. To perform assertions over Command returned values, use ExecuteCmdWithArgsInTest.

func PrepNewCmdFlags

func PrepNewCmdFlags(newCmd *cobra.Command)

Types

This section is empty.

Jump to

Keyboard shortcuts

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