help.h 1.09 KB
Newer Older
1 2 3 4 5 6 7
#ifndef HELP_H
#define HELP_H

struct cmdnames {
	int alloc;
	int cnt;
	struct cmdname {
8
		size_t len; /* also used for similarity index in help.c */
9 10 11 12
		char name[FLEX_ARRAY];
	} **names;
};

Miklos Vajna's avatar
Miklos Vajna committed
13 14 15 16 17 18
static inline void mput_char(char c, unsigned int num)
{
	while(num--)
		putchar(c);
}

19 20 21 22 23 24
extern void list_common_cmds_help(void);
extern const char *help_unknown_cmd(const char *cmd);
extern void load_command_list(const char *prefix,
			      struct cmdnames *main_cmds,
			      struct cmdnames *other_cmds);
extern void add_cmdname(struct cmdnames *cmds, const char *name, int len);
25
/* Here we require that excludes is a sorted list. */
26 27
extern void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
extern int is_in_cmdlist(struct cmdnames *cmds, const char *name);
Junio C Hamano's avatar
Junio C Hamano committed
28
extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, struct cmdnames *other_cmds);
29

Vikrant Varma's avatar
Vikrant Varma committed
30 31 32 33 34
/*
 * call this to die(), when it is suspected that the user mistyped a
 * ref to the command, to give suggested "correct" refs.
 */
extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);
35
#endif /* HELP_H */