MCPcopy Index your code
hub / github.com/git/git / list_cmds

Function list_cmds

git.c:78–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static int list_cmds(const char *spec)
79{
80 struct string_list list = STRING_LIST_INIT_DUP;
81 int nongit;
82
83 /*
84 * Set up the repository so we can pick up any repo-level config (like
85 * completion.commands).
86 */
87 setup_git_directory_gently(the_repository, &nongit);
88
89 while (*spec) {
90 const char *sep = strchrnul(spec, ',');
91 int len = sep - spec;
92
93 if (match_token(spec, len, "builtins"))
94 list_builtins(&list, 0, 0);
95 else if (match_token(spec, len, "main"))
96 list_all_main_cmds(&list);
97 else if (match_token(spec, len, "others"))
98 list_all_other_cmds(&list);
99 else if (match_token(spec, len, "nohelpers"))
100 exclude_helpers_from_list(&list);
101 else if (match_token(spec, len, "alias"))
102 list_aliases(&list);
103 else if (match_token(spec, len, "config"))
104 list_cmds_by_config(&list);
105 else if (match_token(spec, len, "deprecated"))
106 list_builtins(&list, DEPRECATED, 0);
107 else if (len > 5 && !strncmp(spec, "list-", 5)) {
108 struct strbuf sb = STRBUF_INIT;
109
110 strbuf_add(&sb, spec + 5, len - 5);
111 list_cmds_by_category(&list, sb.buf);
112 strbuf_release(&sb);
113 }
114 else
115 die(_("unsupported command listing type '%s'"), spec);
116 spec += len;
117 if (*spec == ',')
118 spec++;
119 }
120 for (size_t i = 0; i < list.nr; i++)
121 puts(list.items[i].string);
122 string_list_clear(&list, 1);
123 return 0;
124}
125
126static void commit_pager_choice(void)
127{

Callers 1

handle_optionsFunction · 0.85

Calls 13

match_tokenFunction · 0.85
list_builtinsFunction · 0.85
list_all_main_cmdsFunction · 0.85
list_all_other_cmdsFunction · 0.85
list_aliasesFunction · 0.85
list_cmds_by_configFunction · 0.85
strbuf_addFunction · 0.85
list_cmds_by_categoryFunction · 0.85
strbuf_releaseFunction · 0.85
string_list_clearFunction · 0.85

Tested by

no test coverage detected