Documentation ¶
Overview ¶
Package cmdutil holds functionality to run titan via cobra. That includes flag parsing and configuration of components common to all subcommands
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdBase ¶
type CmdBase struct { UI cli.Ui Logger hclog.Logger RepoRoot titanpath.AbsoluteSystemPath APIClient *client.ApiClient RepoConfig *config.RepoConfig UserConfig *config.UserConfig RemoteConfig client.RemoteConfig TurboVersion string }
CmdBase encompasses configured components common to all titan commands.
func (*CmdBase) LogWarning ¶
LogWarning logs an error and outputs it to the UI.
type Helper ¶
type Helper struct { // TurboVersion is the version of titan that is currently executing TurboVersion string // UserConfigPath is the path to where we expect to find // a user-specific config file, if one is present. Public // to allow overrides in tests UserConfigPath titanpath.AbsoluteSystemPath // contains filtered or unexported fields }
Helper is a struct used to hold configuration values passed via flag, env vars, config files, etc. It is not intended for direct use by titan commands, it drives the creation of CmdBase, which is then used by the commands themselves.
func NewHelper ¶
NewHelper returns a new helper instance to hold configuration values for the root titan command.
func (*Helper) AddFlags ¶
AddFlags adds common flags for all titan commands to the given flagset and binds them to this instance of Helper
func (*Helper) Cleanup ¶
Cleanup runs the register cleanup handlers. It requires the flags to the root command so that it can construct a UI if necessary
func (*Helper) GetCmdBase ¶
GetCmdBase returns a CmdBase instance configured with values from this helper. It additionally returns a mechanism to set an error, so
func (*Helper) RegisterCleanup ¶
RegisterCleanup saves a function to be run after titan execution, even if the command that runs returns an error