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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user