mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	This commit moves monitor commands to `monior/commands` package. Commands still need access to the `monitor` object and buildx controller so this commit enables this via `Monitor` interface stored in `monitor/types`. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			508 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			508 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package commands
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
 | 
						|
	"github.com/docker/buildx/monitor/types"
 | 
						|
	"github.com/pkg/errors"
 | 
						|
)
 | 
						|
 | 
						|
type KillCmd struct {
 | 
						|
	m types.Monitor
 | 
						|
}
 | 
						|
 | 
						|
func NewKillCmd(m types.Monitor) types.Command {
 | 
						|
	return &KillCmd{m}
 | 
						|
}
 | 
						|
 | 
						|
func (cm *KillCmd) Info() types.CommandInfo {
 | 
						|
	return types.CommandInfo{HelpMessage: "kill buildx server"}
 | 
						|
}
 | 
						|
 | 
						|
func (cm *KillCmd) Exec(ctx context.Context, args []string) error {
 | 
						|
	if err := cm.m.Kill(ctx); err != nil {
 | 
						|
		return errors.Errorf("failed to kill: %v", err)
 | 
						|
	}
 | 
						|
	return nil
 | 
						|
}
 |