help: replace underlining "help -a" headers using hyphens with a blank line
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 25 Apr 2012 11:21:53 +0000 (18:21 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Apr 2012 17:30:11 +0000 (10:30 -0700)
We used to underline a header text, like this:

This is a header
----------------
content...

But calculating text length so that the dashes align with the text
could get complicated because the text could be in any charset in
translated Git.

There is no point to use this pseudo underline; simply a blank
line would do and it even makes it easier to read:

This is a header

content...

While at it, give translators more context to translate, e.g.
e.g. "git commands available..." instead of "%s available..."

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/help.c
help.c
help.h
index 96a462cf1b3c748f6aabb33712d0e0f08f39b313..e63668ade4dd0721c27ca5045bc8a524a147f9c1 100644 (file)
@@ -425,7 +425,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 
        if (show_all) {
                printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
-               list_commands(_("git commands"), &main_cmds, &other_cmds);
+               list_commands(&main_cmds, &other_cmds);
                printf("%s\n", _(git_more_info_string));
                return 0;
        }
diff --git a/help.c b/help.c
index 9e6e0f2ab79b11ee8abc31d68883cdacf7669f41..a39b7bf8971e3ea54f0e0c0f675b3613b156eecd 100644 (file)
--- a/help.c
+++ b/help.c
@@ -203,8 +203,7 @@ void load_command_list(const char *prefix,
        exclude_cmds(other_cmds, main_cmds);
 }
 
-void list_commands(const char *title, struct cmdnames *main_cmds,
-                  struct cmdnames *other_cmds)
+void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
 {
        int i, longest = 0;
 
@@ -217,23 +216,14 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
 
        if (main_cmds->cnt) {
                const char *exec_path = git_exec_path();
-               printf_ln(_("available %s in '%s'"), title, exec_path);
-               /* TRANSLATORS: this must align with "available %s in '%s'" */
-               printf(_("----------------"));
-               mput_char('-', strlen(title) + strlen(exec_path));
+               printf_ln(_("available git commands in '%s'"), exec_path);
                putchar('\n');
                pretty_print_string_list(main_cmds, longest);
                putchar('\n');
        }
 
        if (other_cmds->cnt) {
-               printf_ln(_("%s available from elsewhere on your $PATH"), title);
-               /* TRANSLATORS:
-                * this must align with
-                * "%s available from elsewhere on your $PATH"
-                */
-               printf(_("---------------------------------------"));
-               mput_char('-', strlen(title));
+               printf_ln(_("git commands available from elsewhere on your $PATH"));
                putchar('\n');
                pretty_print_string_list(other_cmds, longest);
                putchar('\n');
diff --git a/help.h b/help.h
index b6b12d5754888438085bb4e574b034951ffec473..dc406c8c50ad2c851b76d446e829550c6c444631 100644 (file)
--- a/help.h
+++ b/help.h
@@ -25,8 +25,7 @@ extern void add_cmdname(struct cmdnames *cmds, const char *name, int len);
 /* Here we require that excludes is a sorted list. */
 extern void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
 extern int is_in_cmdlist(struct cmdnames *cmds, const char *name);
-extern void list_commands(const char *title,
-                         struct cmdnames *main_cmds,
+extern void list_commands(struct cmdnames *main_cmds,
                          struct cmdnames *other_cmds);
 
 #endif /* HELP_H */