1
0
mirror of https://github.com/docker/cli.git synced 2026-10-23 19:12:36 +03:00

cli-plugins/hooks: rename HookMessage to Response

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-03-18 00:44:29 +01:00
parent 60180924e3
commit 607ebfca5d
3 changed files with 17 additions and 10 deletions

View File

@@ -12,3 +12,19 @@ type Request struct {
Flags map[string]string
CommandError string
}
// Response represents a plugin hook response. Plugins
// declaring support for CLI hooks need to print a JSON
// representation of this type when their hook subcommand
// is invoked.
type Response struct {
Type HookType
Template string
}
// HookMessage represents a plugin hook response.
//
// Deprecated: use [Response] instead.
//
//go:fix inline
type HookMessage = Response

View File

@@ -17,15 +17,6 @@ const (
NextSteps = iota
)
// HookMessage represents a plugin hook response. Plugins
// declaring support for CLI hooks need to print a json
// representation of this type when their hook subcommand
// is invoked.
type HookMessage struct {
Type HookType
Template string
}
// TemplateReplaceSubcommandName returns a hook template string
// that will be replaced by the CLI subcommand being executed
//

View File

@@ -86,7 +86,7 @@ func invokeAndCollectHooks(ctx context.Context, cfg *configfile.ConfigFile, root
return nil, false, err
}
var message hooks.HookMessage
var message hooks.Response
if err := json.Unmarshal(resp, &message); err != nil {
return nil, false, fmt.Errorf("failed to unmarshal hook response (%q): %w", string(resp), err)
}