Skip to content

Commit 607ebfc

Browse files
committed
cli-plugins/hooks: rename HookMessage to Response
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 6018092 commit 607ebfc

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

cli-plugins/hooks/hook_types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,19 @@ type Request struct {
1212
Flags map[string]string
1313
CommandError string
1414
}
15+
16+
// Response represents a plugin hook response. Plugins
17+
// declaring support for CLI hooks need to print a JSON
18+
// representation of this type when their hook subcommand
19+
// is invoked.
20+
type Response struct {
21+
Type HookType
22+
Template string
23+
}
24+
25+
// HookMessage represents a plugin hook response.
26+
//
27+
// Deprecated: use [Response] instead.
28+
//
29+
//go:fix inline
30+
type HookMessage = Response

cli-plugins/hooks/template.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ const (
1717
NextSteps = iota
1818
)
1919

20-
// HookMessage represents a plugin hook response. Plugins
21-
// declaring support for CLI hooks need to print a json
22-
// representation of this type when their hook subcommand
23-
// is invoked.
24-
type HookMessage struct {
25-
Type HookType
26-
Template string
27-
}
28-
2920
// TemplateReplaceSubcommandName returns a hook template string
3021
// that will be replaced by the CLI subcommand being executed
3122
//

cli-plugins/manager/hooks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func invokeAndCollectHooks(ctx context.Context, cfg *configfile.ConfigFile, root
8686
return nil, false, err
8787
}
8888

89-
var message hooks.HookMessage
89+
var message hooks.Response
9090
if err := json.Unmarshal(resp, &message); err != nil {
9191
return nil, false, fmt.Errorf("failed to unmarshal hook response (%q): %w", string(resp), err)
9292
}

0 commit comments

Comments
 (0)