MCPcopy Create free account
hub / github.com/git/git / list_cmds_by_category

Function list_cmds_by_category

help.c:394–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394void 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
418void list_cmds_by_config(struct string_list *list)
419{

Callers 1

list_cmdsFunction · 0.85

Calls 3

drop_prefixFunction · 0.85
dieFunction · 0.70
string_list_appendFunction · 0.70

Tested by

no test coverage detected