feat: get handlers return object slices

This commit is contained in:
2025-07-20 15:42:43 +02:00
parent 2e16c67321
commit 45712dacf6
11 changed files with 31 additions and 41 deletions

View File

@ -33,8 +33,8 @@ var verbs = []VerbItem{
return fmt.Errorf("resource does not support GET")
}
// Get item
item, err := h.Get(ctx, params)
// Get items
items, err := h.Get(ctx, params)
if err != nil {
return fmt.Errorf("retrieving item failed: %w", err)
}
@ -46,7 +46,7 @@ var verbs = []VerbItem{
}
// Format and output
formatted, err := formatter.Format(item)
formatted, err := formatter.Format(items)
if err != nil {
return fmt.Errorf("failed to format output: %w", err)
}
@ -61,8 +61,6 @@ var verbs = []VerbItem{
}
func getVerbs(ctx context.Context, config *AppConfig) (commands []*cobra.Command) {
logger := jlog.FromContext(ctx)
for _, v := range verbs {
verbCommand := &cobra.Command{
Use: strings.ToLower(string(v.Name)),
@ -115,8 +113,6 @@ func getVerbs(ctx context.Context, config *AppConfig) (commands []*cobra.Command
)
}
verbCommand.AddCommand(resourceCommand)
logger.Debug(fmt.Sprintf("Registered %s %s", strings.ToUpper(string(v.Name)), r.Name))
}
commands = append(commands, verbCommand)