MCPcopy Create free account
hub / github.com/git/git / cmd_help

Function cmd_help

builtin/help.c:662–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662int cmd_help(int argc,
663 const char **argv,
664 const char *prefix,
665 struct repository *repo UNUSED)
666{
667 int nongit;
668 enum help_format parsed_help_format;
669 char *command = NULL;
670 const char *page;
671
672 argc = parse_options(argc, argv, prefix, builtin_help_options,
673 builtin_help_usage, 0);
674 parsed_help_format = help_format;
675
676 if (cmd_mode != HELP_ACTION_ALL &&
677 (show_external_commands >= 0 ||
678 show_aliases >= 0))
679 usage_msg_opt(_("the '--no-[external-commands|aliases]' options can only be used with '--all'"),
680 builtin_help_usage, builtin_help_options);
681
682 switch (cmd_mode) {
683 case HELP_ACTION_ALL:
684 opt_mode_usage(argc, "--all", help_format);
685 if (verbose) {
686 setup_pager(the_repository);
687 list_all_cmds_help(show_external_commands,
688 show_aliases);
689 return 0;
690 }
691 printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
692 load_command_list("git-", &main_cmds, &other_cmds);
693 list_commands(&main_cmds, &other_cmds);
694 printf("%s\n", _(git_more_info_string));
695 break;
696 case HELP_ACTION_GUIDES:
697 opt_mode_usage(argc, "--guides", help_format);
698 list_guides_help();
699 printf("%s\n", _(git_more_info_string));
700 return 0;
701 case HELP_ACTION_CONFIG_FOR_COMPLETION:
702 opt_mode_usage(argc, "--config-for-completion", help_format);
703 list_config_help(SHOW_CONFIG_VARS);
704 return 0;
705 case HELP_ACTION_USER_INTERFACES:
706 opt_mode_usage(argc, "--user-interfaces", help_format);
707 list_user_interfaces_help();
708 return 0;
709 case HELP_ACTION_DEVELOPER_INTERFACES:
710 opt_mode_usage(argc, "--developer-interfaces", help_format);
711 list_developer_interfaces_help();
712 return 0;
713 case HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION:
714 opt_mode_usage(argc, "--config-sections-for-completion",
715 help_format);
716 list_config_help(SHOW_CONFIG_SECTIONS);
717 return 0;
718 case HELP_ACTION_ALIASES_FOR_COMPLETION: {
719 struct string_list alias_list = STRING_LIST_INIT_DUP;

Callers

nothing calls this directly

Calls 15

parse_optionsFunction · 0.85
usage_msg_optFunction · 0.85
opt_mode_usageFunction · 0.85
setup_pagerFunction · 0.85
list_all_cmds_helpFunction · 0.85
load_command_listFunction · 0.85
list_commandsFunction · 0.85
list_guides_helpFunction · 0.85
list_config_helpFunction · 0.85
list_aliasesFunction · 0.85

Tested by

no test coverage detected