THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

90 lignes
3.1KB

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