(cmd *cobra.Command, args []string)
| 1098 | return err |
| 1099 | } |
| 1100 | |
| 1101 | clientConfig, err := client.LoadConfig() |
| 1102 | if err != nil { |
| 1103 | return fmt.Errorf("failed to load configuration: %w", err) |
| 1104 | } |
| 1105 | c, err := client.NewClient(clientConfig) |
| 1106 | if err != nil { |
| 1107 | return fmt.Errorf("failed to create client: %w", err) |
| 1108 | } |
| 1109 | defer c.Close() |
| 1110 | |
| 1111 | ctx, cancel, err := newTaskRequestContext(taskResultsPaginationFlags.timeoutSeconds) |
| 1112 | if err != nil { |
| 1113 | return err |
| 1114 | } |
| 1115 | defer cancel() |
| 1116 | |
| 1117 | resp, err := c.GetTaskResults(ctx, taskID, &client.PaginationOptions{ |
| 1118 | Limit: taskResultsPaginationFlags.limit, |
| 1119 | Cursor: taskResultsPaginationFlags.cursor, |
| 1120 | }) |
| 1121 | if err != nil { |
| 1122 | return fmt.Errorf("failed to get task results: %w", err) |
| 1123 | } |
| 1124 | |
| 1125 | if IsJSONOutput() { |
| 1126 | return OutputJSON(resp) |
| 1127 | } |
| 1128 | |
| 1129 | if len(resp.Results) == 0 { |
| 1130 | fmt.Println("No results found.") |
| 1131 | return nil |
| 1132 | } |
| 1133 | fmt.Printf("Found %d results:\n\n", len(resp.Results)) |
| 1134 | for _, r := range resp.Results { |
| 1135 | fmt.Printf("- %s (%s) created %s\n", r.Name, r.ResultID, r.CreatedAt) |
| 1136 | if len(r.Metadata) > 0 { |
| 1137 | meta, _ := json.MarshalIndent(r.Metadata, " ", " ") |
| 1138 | fmt.Printf(" metadata: %s\n", string(meta)) |
| 1139 | } |
| 1140 | } |
| 1141 | if resp.Cursor != "" { |
| 1142 | fmt.Printf("\nNext cursor: %s (limit=%d)\n", resp.Cursor, resp.Limit) |
| 1143 | } |
| 1144 | return nil |
| 1145 | } |
| 1146 |
nothing calls this directly
no test coverage detected