summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/help.c')
-rw-r--r--builtin/help.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/builtin/help.c b/builtin/help.c
index 222f994..dc1fbe2 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -1,15 +1,18 @@
/*
* Builtin help command
*/
-#include "cache.h"
-#include "config.h"
#include "builtin.h"
+#include "config.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "pager.h"
#include "parse-options.h"
+#include "path.h"
#include "run-command.h"
#include "config-list.h"
#include "help.h"
#include "alias.h"
+#include "setup.h"
#ifndef DEFAULT_HELP_FORMAT
#define DEFAULT_HELP_FORMAT "man"
@@ -43,6 +46,8 @@ static enum help_action {
HELP_ACTION_ALL = 1,
HELP_ACTION_GUIDES,
HELP_ACTION_CONFIG,
+ HELP_ACTION_USER_INTERFACES,
+ HELP_ACTION_DEVELOPER_INTERFACES,
HELP_ACTION_CONFIG_FOR_COMPLETION,
HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION,
} cmd_mode;
@@ -69,6 +74,12 @@ static struct option builtin_help_options[] = {
OPT_CMDMODE('g', "guides", &cmd_mode, N_("print list of useful guides"),
HELP_ACTION_GUIDES),
+ OPT_CMDMODE(0, "user-interfaces", &cmd_mode,
+ N_("print list of user-facing repository, command and file interfaces"),
+ HELP_ACTION_USER_INTERFACES),
+ OPT_CMDMODE(0, "developer-interfaces", &cmd_mode,
+ N_("print list of file formats, protocols and other developer interfaces"),
+ HELP_ACTION_DEVELOPER_INTERFACES),
OPT_CMDMODE('c', "config", &cmd_mode, N_("print all configuration variable names"),
HELP_ACTION_CONFIG),
OPT_CMDMODE_F(0, "config-for-completion", &cmd_mode, "",
@@ -80,10 +91,12 @@ static struct option builtin_help_options[] = {
};
static const char * const builtin_help_usage[] = {
- "git help [-a|--all] [--[no-]verbose]] [--[no-]external-commands] [--[no-]aliases]",
- N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>]"),
+ "git help [-a|--all] [--[no-]verbose] [--[no-]external-commands] [--[no-]aliases]",
+ N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]"),
"git help [-g|--guides]",
"git help [-c|--config]",
+ "git help [--user-interfaces]",
+ "git help [--developer-interfaces]",
NULL
};
@@ -384,7 +397,8 @@ static int add_man_viewer_info(const char *var, const char *value)
return 0;
}
-static int git_help_config(const char *var, const char *value, void *cb)
+static int git_help_config(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
{
if (!strcmp(var, "help.format")) {
if (!value)
@@ -407,7 +421,7 @@ static int git_help_config(const char *var, const char *value, void *cb)
if (starts_with(var, "man."))
return add_man_viewer_info(var, value);
- return git_default_config(var, value, cb);
+ return git_default_config(var, value, ctx, cb);
}
static struct cmdnames main_cmds, other_cmds;
@@ -430,6 +444,8 @@ static const char *cmd_to_page(const char *git_cmd)
return git_cmd;
else if (is_git_command(git_cmd))
return xstrfmt("git-%s", git_cmd);
+ else if (!strcmp("scalar", git_cmd))
+ return xstrdup(git_cmd);
else
return xstrfmt("git%s", git_cmd);
}
@@ -654,6 +670,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
opt_mode_usage(argc, "--config-for-completion", help_format);
list_config_help(SHOW_CONFIG_VARS);
return 0;
+ case HELP_ACTION_USER_INTERFACES:
+ opt_mode_usage(argc, "--user-interfaces", help_format);
+ list_user_interfaces_help();
+ return 0;
+ case HELP_ACTION_DEVELOPER_INTERFACES:
+ opt_mode_usage(argc, "--developer-interfaces", help_format);
+ list_developer_interfaces_help();
+ return 0;
case HELP_ACTION_CONFIG_SECTIONS_FOR_COMPLETION:
opt_mode_usage(argc, "--config-sections-for-completion",
help_format);