MCPcopy Create free account
hub / github.com/compozy/agh / newHooksInfoCommand

Function newHooksInfoCommand

internal/cli/hooks.go:76–111  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

74}
75
76func newHooksInfoCommand(deps commandDeps) *cobra.Command {
77 var workspace string
78
79 cmd := &cobra.Command{
80 Use: hooksInfoNameValue,
81 Short: "Show detailed information for one or more hooks by name",
82 Args: exactOneNonBlankArg(),
83 RunE: func(cmd *cobra.Command, args []string) error {
84 client, err := clientFromDeps(deps)
85 if err != nil {
86 return err
87 }
88
89 hooks, err := client.HookCatalog(cmd.Context(), HookCatalogQuery{Workspace: workspace})
90 if err != nil {
91 return err
92 }
93
94 name := strings.TrimSpace(args[0])
95 matches := make([]HookCatalogRecord, 0)
96 for _, hook := range hooks {
97 if strings.TrimSpace(hook.Name) == name {
98 matches = append(matches, hook)
99 }
100 }
101 if len(matches) == 0 {
102 return fmt.Errorf("cli: no hooks named %q found", name)
103 }
104
105 return writeCommandOutput(cmd, hookInfoBundle(matches))
106 },
107 }
108
109 cmd.Flags().StringVar(&workspace, "workspace", "", "Resolve hooks in one workspace context")
110 return cmd
111}
112
113func newHooksEventsCommand(deps commandDeps) *cobra.Command {
114 var query HookEventsQuery

Callers 1

newHooksCommandFunction · 0.85

Calls 6

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
appendFunction · 0.85
writeCommandOutputFunction · 0.85
hookInfoBundleFunction · 0.85
HookCatalogMethod · 0.65

Tested by

no test coverage detected