Documentation
¶
Overview ¶
Package helpers provides CLI-specific helper functions for Tempo commands.
This package contains utilities that are specifically designed for CLI command implementations and should only be imported by packages in cmd/tempo/*.
Logger Helpers (logger.go) ¶
Functions for managing logger state in CLI commands:
- EnableLoggerIndentation - Enable indented output for nested logging
- ResetLogger - Reset logger to default state after command completion
- LogSuccessMessages - Log standardized success messages for entity creation
Error Builders (errors.go) ¶
Functions for building user-friendly error messages:
- BuildMissingFoldersError - Build error message for missing folder validation
Entity Helpers (entity.go) ¶
Functions for handling entity existence checks in CLI commands:
- CheckEntityForNew - Log warning/info when creating entities that exist
- CheckEntityForDefine - Log warning/info when defining templates that exist
Usage ¶
These helpers are designed to be used in CLI command implementations:
func runCommand(cmdCtx *app.AppContext) func(ctx context.Context, cmd *cli.Command) error {
return func(ctx context.Context, cmd *cli.Command) error {
helpers.EnableLoggerIndentation(cmdCtx.Logger)
defer helpers.ResetLogger(cmdCtx.Logger)
// Command implementation...
return nil
}
}
Index ¶
- func BuildMissingFoldersError(missingFolders map[string]string, contextMsg string, helpCommands []string) error
- func CheckEntityForDefine(entityType, outputPath string, force bool, logr logger.Logger)
- func CheckEntityForNew(entityType, entityName, outputPath string, force bool, logr logger.Logger)
- func EnableLoggerIndentation(log logger.Logger)
- func LogSuccessMessages(entityType string, cfg *config.Config, logger logger.Logger)
- func ResetLogger(log logger.Logger)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMissingFoldersError ¶
func BuildMissingFoldersError(missingFolders map[string]string, contextMsg string, helpCommands []string) error
BuildMissingFoldersError constructs an error message for missing folders.
func CheckEntityForDefine ¶ added in v0.3.0
CheckEntityForDefine logs a warning or info message when defining templates that already exist.
func CheckEntityForNew ¶ added in v0.3.0
CheckEntityForNew logs a warning or info message when creating a new entity that already exists. It handles both component and variant entity types with appropriate path formatting.
func EnableLoggerIndentation ¶
EnableLoggerIndentation ensures consistent indentation.
func LogSuccessMessages ¶
LogSuccessMessages logs the success messages for generated template files and assets.
func ResetLogger ¶
Types ¶
This section is empty.