Documentation
¶
Index ¶
- Variables
- func Execute()
- func ExecuteCmdWithArgsInTest(t *testing.T, cmd *cobra.Command, args ...string) (string, error)
- func ExecuteCmdWithStdinPipe(t *testing.T, cmd *cobra.Command, toStdin string, args ...string) (string, error)
- func ExecuteCmdWithStdoutPipe(t *testing.T, cmd *cobra.Command, args ...string) (string, error)
- func PrepNewCmdFlags(newCmd *cobra.Command)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ExecuteCmdWithStdoutPipe ¶
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 ¶
Types ¶
This section is empty.