Documentation
¶
Overview ¶
Package common provides shared functionality for pipeleek platform-specific binaries.
Index ¶
- Variables
- func AddCommonFlags(cmd *cobra.Command)
- func InitLogger(cmd *cobra.Command)
- func RestoreTerminalState()
- func Run(rootCmd *cobra.Command)
- func SaveTerminalState()
- func SetGlobalLogLevel(cmd *cobra.Command)
- func SetupPersistentPreRun(cmd *cobra.Command)
- type CustomWriter
- type FatalHook
- type TerminalRestoringWriter
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
Version information - set via ldflags during build
var ( JsonLogoutput bool LogFile string LogColor bool LogDebug bool LogLevel string IgnoreProxy bool )
Log configuration
var TerminalRestorer func()
TerminalRestorer is a function that can be called to restore terminal state
Functions ¶
func AddCommonFlags ¶
AddCommonFlags adds the common logging and output flags to a cobra command
func InitLogger ¶
InitLogger initializes the zerolog logger with the configured options
func RestoreTerminalState ¶
func RestoreTerminalState()
RestoreTerminalState restores the terminal to its saved state
func SaveTerminalState ¶
func SaveTerminalState()
SaveTerminalState saves the current terminal state for later restoration
func SetGlobalLogLevel ¶
SetGlobalLogLevel sets the global log level based on the configured options
func SetupPersistentPreRun ¶
SetupPersistentPreRun sets up the PersistentPreRun handler for logging initialization
Types ¶
type CustomWriter ¶
CustomWriter wraps an os.File with proper cross-platform newline handling
type FatalHook ¶
type FatalHook struct{}
FatalHook is a zerolog hook that restores terminal state before fatal exits
type TerminalRestoringWriter ¶
type TerminalRestoringWriter struct {
// contains filtered or unexported fields
}
TerminalRestoringWriter wraps an io.Writer to restore terminal state on fatal logs