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