Documentation
¶
Overview ¶
Package cmd contains the command-line interface (CLI) definitions and execution logic for Watchtower. It provides the root command and subcommands to orchestrate container updates, notifications, and configuration upgrades.
Key components:
- rootCmd: Root command for updates, API, and scheduling.
- notify-upgrade: Subcommand to convert legacy notifications to shoutrrr URLs.
- RunConfig: Struct for configuring execution.
Usage examples:
- Run the CLI from main.go: log := logging.New(os.Stderr, logging.InfoLevel) cmd.Execute(log)
- Convert legacy notifications to shoutrrr URLs: watchtower notify-upgrade
The package integrates with actions, container, notifications, and flags packages, using Cobra for CLI parsing and github.com/rs/zerolog for process logging. The composition root constructs a *zerolog.Logger in main and passes it through Execute. There is no package-level global logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute runs the root command and manages any errors encountered during its execution.
It serves as the primary entry point for the Watchtower CLI, called from main.go, and ensures that any fatal errors are logged and terminate the program with an appropriate exit status, providing a clean interface between the CLI and the operating system.
Parameters:
- log: Process logger from main (reconfigured in preRun from --log-format / --log-level).
func NewRootCommand ¶
NewRootCommand creates and configures the root command for the Watchtower CLI.
It establishes the base usage string ("watchtower"), a short description summarizing its purpose, and a long description with additional context and a project URL.
PreRun and Run are wired in Execute with a logger-capturing process instance so the composition root can pass *zerolog.Logger without a package-level global.
Returns:
- *cobra.Command: A pointer to the fully configured root command, ready for flag registration and execution.
Types ¶
This section is empty.