| 176 | }; |
| 177 | |
| 178 | static void list(struct add_i_state *s, struct string_list *list, int *selected, |
| 179 | struct list_options *opts) |
| 180 | { |
| 181 | int i, last_lf = 0; |
| 182 | |
| 183 | if (!list->nr) |
| 184 | return; |
| 185 | |
| 186 | if (opts->header) |
| 187 | color_fprintf_ln(stdout, s->cfg.header_color, |
| 188 | "%s", opts->header); |
| 189 | |
| 190 | for (i = 0; i < list->nr; i++) { |
| 191 | opts->print_item(i, selected ? selected[i] : 0, list->items + i, |
| 192 | opts->print_item_data); |
| 193 | |
| 194 | if ((opts->columns) && ((i + 1) % (opts->columns))) { |
| 195 | putchar('\t'); |
| 196 | last_lf = 0; |
| 197 | } |
| 198 | else { |
| 199 | putchar('\n'); |
| 200 | last_lf = 1; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | if (!last_lf) |
| 205 | putchar('\n'); |
| 206 | } |
| 207 | struct list_and_choose_options { |
| 208 | struct list_options list_opts; |
| 209 |
no test coverage detected