MCPcopy Index your code
hub / github.com/docker/cli / matchHookConfig

Function matchHookConfig

cli-plugins/manager/hooks.go:177–189  ·  view source on GitHub ↗

matchHookConfig checks if a comma-separated hook configuration string contains a prefix match for the given subcommand.

(configuredHooks string, subCmd string)

Source from the content-addressed store, hash-verified

175// matchHookConfig checks if a comma-separated hook configuration string
176// contains a prefix match for the given subcommand.
177func matchHookConfig(configuredHooks string, subCmd string) (string, bool) {
178 if configuredHooks == "" {
179 return "", false
180 }
181
182 for hookCmd := range strings.SplitSeq(configuredHooks, ",") {
183 if hookMatch(hookCmd, subCmd) {
184 return hookCmd, true
185 }
186 }
187
188 return "", false
189}
190
191func hookMatch(hookCmd, subCmd string) bool {
192 hookCmdTokens := strings.Split(hookCmd, " ")

Callers 2

TestMatchHookConfigFunction · 0.85
pluginMatchFunction · 0.85

Calls 1

hookMatchFunction · 0.85

Tested by 1

TestMatchHookConfigFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…