Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRootCommand ¶ added in v1.0.6
func BuildRootCommand(testCfg *TestConfig) *cobra.Command
BuildRootCommand constructs a fully-initialized root cobra command including all flags and sub-commands. This function is called from main(), but otherwise is principally used for tests.
The cfg parameter is used to control certain aspect of execution in unit tests. Note that this should usually just be set to nil, and many of the fields you could set may be overwritten when cfg.init is subsequently called.
**Parameters:**
cfg: a Config struct used to control certain aspects of execution
**Returns:**
*cobra.Command: The initialized root cobra command
Types ¶
type Config ¶
type Config struct { RepoSpecs []repos.Spec `yaml:"repos"` // contains filtered or unexported fields }
Config stores the variables from the TTPForge global config file we export it for use in tests, but packages besides `cmd` probably should not touch it
type TestConfig ¶ added in v1.0.10
type TestConfig struct { // used for capturing output in tests // note: these are presently only supported by the `run` // command because they are passed to lower layers through // TTPExecutionContext Stdout io.Writer Stderr io.Writer }
TestConfig is used to pass test-specific settings to BuildRootCommand its entries are copied into the global config object