| 392 | } |
| 393 | |
| 394 | void list_cmds_by_category(struct string_list *list, |
| 395 | const char *cat) |
| 396 | { |
| 397 | int i, n = ARRAY_SIZE(command_list); |
| 398 | uint32_t cat_id = 0; |
| 399 | |
| 400 | for (i = 0; category_names[i]; i++) { |
| 401 | if (!strcmp(cat, category_names[i])) { |
| 402 | cat_id = 1UL << i; |
| 403 | break; |
| 404 | } |
| 405 | } |
| 406 | if (!cat_id) |
| 407 | die(_("unsupported command listing type '%s'"), cat); |
| 408 | |
| 409 | for (i = 0; i < n; i++) { |
| 410 | struct cmdname_help *cmd = command_list + i; |
| 411 | |
| 412 | if (!(cmd->category & cat_id)) |
| 413 | continue; |
| 414 | string_list_append(list, drop_prefix(cmd->name, cmd->category)); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | void list_cmds_by_config(struct string_list *list) |
| 419 | { |
no test coverage detected