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