git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] help: replace underlining "help -a" headers using hyphens with a blank line

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Apr 25, 2012, 11:21 UTC
Message-ID
<1335352913-32684-1-git-send-email-pclouds@gmail.com>
In-Reply-To
<20120423183439.GA12916@burratino>
We want the underline to align with the text above, for example:

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

Unfortunately calculating text length could get complicated because the text could be in any charset in translated Git. Avoid it and print a blank line (i.e. charset neutral) instead. Readability is not affected much. After the change we get:

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>
---
 2012/4/24 Jonathan Nieder <jrnieder@gmail.com>:
 > Junio C Hamano wrote:
 >
 >>                                                        Wouldn't a simple
 >> and clean "blank line" look better?
 >
 > Yes, based on a quick test with "vi" it looks reasonable.  Thanks for
 > a sanity check.
 And it does _not_ assume the translated text is in utf-8.
 And thanks Junio for fixing the other nit before merging the seriess
 to next. I should have read and reacted on these posts yesterday.
 builtin/help.c |    2 +-
 help.c         |   16 +++-------------
 help.h         |    3 +--
 3 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/builtin/help.c b/builtin/help.c
index 96a462c..e63668a 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -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 9e6e0f2..baaf379 100644
--- 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 b6b12d5..dc406c8 100644
--- 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 */
-- 
1.7.8.36.g69ee2
Previous: Jonathan NiederNext: Junio C Hamano
Message 18 of 43 in “i18n relative dates, help, remote, apply, index-pack and bundle”
  1. 00/10 i18n relative dates, help, remote, apply, index-pack and bundleNguyễn Thái Ngọc Duy, Apr 23, 2012
  2. 01/10 Makefile: feed all header files to xgettextNguyễn Thái Ngọc Duy, Apr 23, 2012
  3. 02/10 Add three convenient format printing functions with \n automatically appendedNguyễn Thái Ngọc Duy, Apr 23, 2012
  4. Jonathan NiederApr 23, 2012
  5. 03/10 i18n: mark relative dates for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  6. Junio C HamanoApr 24, 2012
  7. Nguyen Thai Ngoc DuyApr 25, 2012
  8. Johannes SixtApr 25, 2012
  9. Zbigniew Jędrzejewski-SzmekApr 25, 2012
  10. Nguyen Thai Ngoc DuyApr 25, 2012
  11. Jonathan NiederApr 25, 2012
  12. Junio C HamanoApr 25, 2012
  13. Jonathan NiederApr 25, 2012
  14. 04/10 i18n: help: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  15. Jonathan NiederApr 23, 2012
  16. Junio C HamanoApr 23, 2012
  17. Jonathan NiederApr 23, 2012
  18. help: replace underlining "help -a" headers using hyphens with a blank lineNguyễn Thái Ngọc Duy, Apr 25, 2012
  19. Junio C HamanoApr 25, 2012
  20. 05/10 i18n: make warn_dangling_symref() automatically append \nNguyễn Thái Ngọc Duy, Apr 23, 2012
  21. 06/10 i18n: remote: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  22. Junio C HamanoApr 25, 2012
  23. Nguyen Thai Ngoc DuyApr 26, 2012
  24. 07/10 i18n: apply: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  25. Junio C HamanoApr 25, 2012
  26. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 6, 2012
  27. Junio C HamanoMay 7, 2012
  28. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 8, 2012
  29. Junio C HamanoMay 8, 2012
  30. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 9, 2012
  31. 08/10 i18n: apply: update say_patch_name to give translators complete sentenceNguyễn Thái Ngọc Duy, Apr 23, 2012
  32. 09/10 i18n: index-pack: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  33. 10/10 i18n: bundle: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  34. Junio C HamanoApr 25, 2012
  35. Nguyen Thai Ngoc DuyApr 26, 2012
  36. bundle: remove stray single-quote from error messageJonathan Nieder, Apr 26, 2012
  37. Jonathan NiederApr 23, 2012
  38. Junio C HamanoApr 23, 2012
  39. Ævar Arnfjörð BjarmasonApr 23, 2012
  40. Nguyen Thai Ngoc DuyApr 24, 2012
  41. Junio C HamanoApr 24, 2012
  42. Nguyen Thai Ngoc DuyApr 25, 2012
  43. Jonathan NiederApr 25, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.