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