executeParentHook re-runs the nearest ancestor's persistent pre-run hook, which the hook installed by EnableRepoOverride would otherwise shadow. By default cobra runs only the nearest PersistentPreRunE found walking up from the invoked command, so without this the nearest ancestor hook, such as the
(overrideCmd, cmd *cobra.Command, args []string)
| 25 | // develop and EnableRepoOverride re-run by hand, and un-suppressing the root |
| 26 | // gate that agent-task and skills intentionally shadow. |
| 27 | func executeParentHook(overrideCmd, cmd *cobra.Command, args []string) error { |
| 28 | for p := overrideCmd.Parent(); p != nil; p = p.Parent() { |
| 29 | if p.PersistentPreRunE != nil { |
| 30 | return p.PersistentPreRunE(cmd, args) |
| 31 | } |
| 32 | } |
| 33 | return nil |
| 34 | } |
| 35 | |
| 36 | func EnableRepoOverride(cmd *cobra.Command, f *Factory) { |
| 37 | cmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") |
no outgoing calls
no test coverage detected