]> git.ipfire.org Git - thirdparty/git.git/blame_incremental - help.h
The sixth batch
[thirdparty/git.git] / help.h
... / ...
CommitLineData
1#ifndef HELP_H
2#define HELP_H
3
4#include "string-list.h"
5#include "strbuf.h"
6
7struct cmdnames {
8 int alloc;
9 int cnt;
10 struct cmdname {
11 size_t len; /* also used for similarity index in help.c */
12 char name[FLEX_ARRAY];
13 } **names;
14};
15
16void cmdnames_release(struct cmdnames *cmds);
17
18static inline void mput_char(char c, unsigned int num)
19{
20 while (num--)
21 putchar(c);
22}
23
24void list_common_cmds_help(void);
25void list_all_cmds_help(int show_external_commands, int show_aliases);
26void list_guides_help(void);
27void list_user_interfaces_help(void);
28void list_developer_interfaces_help(void);
29
30void list_all_main_cmds(struct string_list *list);
31void list_all_other_cmds(struct string_list *list);
32void list_cmds_by_category(struct string_list *list,
33 const char *category);
34void list_cmds_by_config(struct string_list *list);
35char *help_unknown_cmd(const char *cmd);
36void load_command_list(const char *prefix,
37 struct cmdnames *main_cmds,
38 struct cmdnames *other_cmds);
39void load_builtin_commands(const char *prefix, struct cmdnames *cmds);
40void add_cmdname(struct cmdnames *cmds, const char *name, int len);
41/* Here we require that excludes is a sorted list. */
42void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
43int is_in_cmdlist(struct cmdnames *cmds, const char *name);
44void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds);
45void get_version_info(struct strbuf *buf, int show_build_options);
46
47/*
48 * call this to die(), when it is suspected that the user mistyped a
49 * ref to the command, to give suggested "correct" refs.
50 */
51NORETURN void help_unknown_ref(const char *ref, const char *cmd, const char *error);
52
53static inline void list_config_item(struct string_list *list,
54 const char *prefix,
55 const char *str)
56{
57 string_list_append_nodup(list, xstrfmt("%s.%s", prefix, str));
58}
59
60#define define_list_config_array(array) \
61void list_config_##array(struct string_list *list, const char *prefix) \
62{ \
63 for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
64 if (array[i]) \
65 list_config_item(list, prefix, array[i]); \
66} \
67struct string_list
68
69#define define_list_config_array_extra(array, values) \
70void list_config_##array(struct string_list *list, const char *prefix) \
71{ \
72 static const char *extra[] = values; \
73 for (size_t i = 0; i < ARRAY_SIZE(extra); i++) \
74 list_config_item(list, prefix, extra[i]); \
75 for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
76 if (array[i]) \
77 list_config_item(list, prefix, array[i]); \
78} \
79struct string_list
80
81/* These are actually scattered over many C files */
82void list_config_advices(struct string_list *list, const char *prefix);
83void list_config_color_branch_slots(struct string_list *list, const char *prefix);
84void list_config_color_decorate_slots(struct string_list *list, const char *prefix);
85void list_config_color_diff_slots(struct string_list *list, const char *prefix);
86void list_config_color_grep_slots(struct string_list *list, const char *prefix);
87void list_config_color_interactive_slots(struct string_list *list, const char *prefix);
88void list_config_color_status_slots(struct string_list *list, const char *prefix);
89void list_config_color_sideband_slots(struct string_list *list, const char *prefix);
90void list_config_fsck_msg_ids(struct string_list *list, const char *prefix);
91
92#endif /* HELP_H */