MCPcopy
hub / github.com/docker/compose / HooksCommand

Function HooksCommand

cmd/compose/hooks.go:161–172  ·  view source on GitHub ↗

HooksCommand returns the hidden subcommand that the Docker CLI invokes after command execution when the compose plugin has hooks configured. Docker Desktop is responsible for registering which commands trigger hooks in the docker CLI config; the handler gates all hints on the LogsTab feature flag be

()

Source from the content-addressed store, hash-verified

159// in the docker CLI config; the handler gates all hints on the LogsTab
160// feature flag before emitting them.
161func HooksCommand() *cobra.Command {
162 return &cobra.Command{
163 Use: metadata.HookSubcommandName,
164 Hidden: true,
165 // Override PersistentPreRunE to prevent the parent's PersistentPreRunE
166 // (plugin initialization) from running for hook invocations.
167 PersistentPreRunE: func(*cobra.Command, []string) error { return nil },
168 RunE: func(cmd *cobra.Command, args []string) error {
169 return handleHook(cmd.Context(), args, cmd.OutOrStdout())
170 },
171 }
172}
173
174func handleHook(ctx context.Context, args []string, w io.Writer) error {
175 if len(args) == 0 {

Callers

nothing calls this directly

Calls 1

handleHookFunction · 0.85

Tested by

no test coverage detected