Files
buildx/monitor/commands/reload.go
T
Jonathan A. Sternberg 21ebf82c99 monitor: refactor how reload works
The build now happens in a loop and the monitor is run after every
build. The monitor can return `ErrReload` to signal to the main thread
that it should reload the build result.

This will be used in the future to move the monitor into a callback
rather than as a separate existence. It allows the monitor to not
control the build itself which now makes it possible to completely
remove the controller.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-06-04 15:06:31 -05:00

32 lines
503 B
Go

package commands
import (
"context"
"github.com/docker/buildx/monitor/types"
)
type ReloadCmd struct {
m types.Monitor
}
func NewReloadCmd(m types.Monitor) types.Command {
return &ReloadCmd{m: m}
}
func (cm *ReloadCmd) Info() types.CommandInfo {
return types.CommandInfo{
Name: "reload",
HelpMessage: "reloads the context and build it",
HelpMessageLong: `
Usage:
reload
`,
}
}
func (cm *ReloadCmd) Exec(ctx context.Context, args []string) error {
cm.m.Reload()
return nil
}