git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add the possibility to specify a default help format
@ 2012-06-06 12:56 Vincent van Ravesteijn
  2012-06-06 13:53 ` Jeff King
  2012-06-06 20:28 ` [PATCHv2] Add the possibility to specify a default help format Vincent van Ravesteijn
  0 siblings, 2 replies; 8+ messages in thread
From: Vincent van Ravesteijn @ 2012-06-06 12:56 UTC (permalink / raw)
  To: git; +Cc: gitster, Vincent van Ravesteijn

At the moment, the default help format (i.e. the format that is chosen if
'git help xxx' is called without a help format parameter) is defined by
the switch to be 'man'. However, on different platforms the preferred
format might differ. For example, on Windows there is no man viewer, so we
would prefer html.

This patch adds the possibility to choose a default help format on
compilation by defining DEFAULT_HELP_FORMAT. If it is not specified the
default is still 'man'.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 builtin/help.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin/help.c b/builtin/help.c
index 43d3c84..536d4fd 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -12,6 +12,10 @@
 #include "column.h"
 #include "help.h"
 
+#ifndef DEFAULT_HELP_FORMAT
+#define DEFAULT_HELP_FORMAT "man"
+#endif
+
 static struct man_viewer_list {
 	struct man_viewer_list *next;
 	char name[FLEX_ARRAY];
@@ -445,7 +449,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	setup_git_directory_gently(&nongit);
 	git_config(git_help_config, NULL);
 
-	if (parsed_help_format != HELP_FORMAT_NONE)
+	if (parsed_help_format == HELP_FORMAT_NONE)
+		help_format = parse_help_format(DEFAULT_HELP_FORMAT);
+	else
 		help_format = parsed_help_format;
 
 	alias = alias_lookup(argv[0]);
-- 
1.7.9.msysgit.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-06 21:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 12:56 [PATCH] Add the possibility to specify a default help format Vincent van Ravesteijn
2012-06-06 13:53 ` Jeff King
2012-06-06 18:51   ` [PATCH] Add the DEFAULT_HELP_FORMAT option to Makefile vfr
2012-06-06 19:06     ` Junio C Hamano
2012-06-06 20:25       ` Vincent van Ravesteijn
2012-06-06 21:07         ` Junio C Hamano
2012-06-06 20:28 ` [PATCHv2] Add the possibility to specify a default help format Vincent van Ravesteijn
2012-06-06 21:21   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).