matchHookConfig checks if a comma-separated hook configuration string contains a prefix match for the given subcommand.
(configuredHooks string, subCmd string)
| 175 | // matchHookConfig checks if a comma-separated hook configuration string |
| 176 | // contains a prefix match for the given subcommand. |
| 177 | func 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 | |
| 191 | func hookMatch(hookCmd, subCmd string) bool { |
| 192 | hookCmdTokens := strings.Split(hookCmd, " ") |
searching dependent graphs…