summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c70
1 files changed, 55 insertions, 15 deletions
diff --git a/help.c b/help.c
index 41c41c2..2dbe57b 100644
--- a/help.c
+++ b/help.c
@@ -1,9 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "builtin.h"
#include "exec-cmd.h"
#include "run-command.h"
#include "levenshtein.h"
+#include "gettext.h"
#include "help.h"
#include "command-list.h"
#include "string-list.h"
@@ -38,19 +39,30 @@ static struct category_description main_categories[] = {
{ CAT_plumbinginterrogators, N_("Low-level Commands / Interrogators") },
{ CAT_synchingrepositories, N_("Low-level Commands / Syncing Repositories") },
{ CAT_purehelpers, N_("Low-level Commands / Internal Helpers") },
+ { CAT_userinterfaces, N_("User-facing repository, command and file interfaces") },
+ { CAT_developerinterfaces, N_("Developer-facing file formats, protocols and other interfaces") },
{ 0, NULL }
};
static const char *drop_prefix(const char *name, uint32_t category)
{
const char *new_name;
-
- if (skip_prefix(name, "git-", &new_name))
- return new_name;
- if (category == CAT_guide && skip_prefix(name, "git", &new_name))
+ const char *prefix;
+
+ switch (category) {
+ case CAT_guide:
+ case CAT_userinterfaces:
+ case CAT_developerinterfaces:
+ prefix = "git";
+ break;
+ default:
+ prefix = "git-";
+ break;
+ }
+ if (skip_prefix(name, prefix, &new_name))
return new_name;
- return name;
+ return name;
}
static void extract_cmds(struct cmdname_help **p_cmds, uint32_t mask)
@@ -296,7 +308,8 @@ void load_command_list(const char *prefix,
exclude_cmds(other_cmds, main_cmds);
}
-static int get_colopts(const char *var, const char *value, void *data)
+static int get_colopts(const char *var, const char *value,
+ const struct config_context *ctx UNUSED, void *data)
{
unsigned int *colopts = data;
@@ -426,12 +439,36 @@ void list_guides_help(void)
putchar('\n');
}
-static int get_alias(const char *var, const char *value, void *data)
+void list_user_interfaces_help(void)
+{
+ struct category_description catdesc[] = {
+ { CAT_userinterfaces, N_("User-facing repository, command and file interfaces:") },
+ { 0, NULL }
+ };
+ print_cmd_by_category(catdesc, NULL);
+ putchar('\n');
+}
+
+void list_developer_interfaces_help(void)
+{
+ struct category_description catdesc[] = {
+ { CAT_developerinterfaces, N_("File formats, protocols and other developer interfaces:") },
+ { 0, NULL }
+ };
+ print_cmd_by_category(catdesc, NULL);
+ putchar('\n');
+}
+
+static int get_alias(const char *var, const char *value,
+ const struct config_context *ctx UNUSED, void *data)
{
struct string_list *list = data;
- if (skip_prefix(var, "alias.", &var))
+ if (skip_prefix(var, "alias.", &var)) {
+ if (!value)
+ return config_error_nonbool(var);
string_list_append(list, var)->util = xstrdup(value);
+ }
return 0;
}
@@ -509,7 +546,9 @@ static struct cmdnames aliases;
#define AUTOCORRECT_NEVER (-2)
#define AUTOCORRECT_IMMEDIATELY (-1)
-static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
+static int git_unknown_cmd_config(const char *var, const char *value,
+ const struct config_context *ctx,
+ void *cb UNUSED)
{
const char *p;
@@ -523,7 +562,7 @@ static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
} else if (!strcmp(value, "prompt")) {
autocorrect = AUTOCORRECT_PROMPT;
} else {
- int v = git_config_int(var, value);
+ int v = git_config_int(var, value, ctx->kvi);
autocorrect = (v < 0)
? AUTOCORRECT_IMMEDIATELY : v;
}
@@ -532,7 +571,7 @@ static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
if (skip_prefix(var, "alias.", &p))
add_cmdname(&aliases, p, strlen(p));
- return git_default_config(var, value, cb);
+ return 0;
}
static int levenshtein_compare(const void *p1, const void *p2)
@@ -726,7 +765,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
struct strbuf buf = STRBUF_INIT;
int build_options = 0;
const char * const usage[] = {
- N_("git version [<options>]"),
+ N_("git version [--build-options]"),
NULL
};
struct option options[] = {
@@ -750,8 +789,9 @@ struct similar_ref_cb {
struct string_list *similar_refs;
};
-static int append_similar_ref(const char *refname, const struct object_id *oid,
- int flags, void *cb_data)
+static int append_similar_ref(const char *refname,
+ const struct object_id *oid UNUSED,
+ int flags UNUSED, void *cb_data)
{
struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
char *branch = strrchr(refname, '/') + 1;