Skip to content

Commit 4470ef9

Browse files
pcloudsgitster
authored andcommitted
help: replace underlining "help -a" headers using hyphens with a blank line
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>
1 parent 8a1e7ea commit 4470ef9

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

builtin/help.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
425425

426426
if (show_all) {
427427
printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
428-
list_commands(_("git commands"), &main_cmds, &other_cmds);
428+
list_commands(&main_cmds, &other_cmds);
429429
printf("%s\n", _(git_more_info_string));
430430
return 0;
431431
}

help.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ void load_command_list(const char *prefix,
203203
exclude_cmds(other_cmds, main_cmds);
204204
}
205205

206-
void list_commands(const char *title, struct cmdnames *main_cmds,
207-
struct cmdnames *other_cmds)
206+
void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
208207
{
209208
int i, longest = 0;
210209

@@ -217,23 +216,14 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
217216

218217
if (main_cmds->cnt) {
219218
const char *exec_path = git_exec_path();
220-
printf_ln(_("available %s in '%s'"), title, exec_path);
221-
/* TRANSLATORS: this must align with "available %s in '%s'" */
222-
printf(_("----------------"));
223-
mput_char('-', strlen(title) + strlen(exec_path));
219+
printf_ln(_("available git commands in '%s'"), exec_path);
224220
putchar('\n');
225221
pretty_print_string_list(main_cmds, longest);
226222
putchar('\n');
227223
}
228224

229225
if (other_cmds->cnt) {
230-
printf_ln(_("%s available from elsewhere on your $PATH"), title);
231-
/* TRANSLATORS:
232-
* this must align with
233-
* "%s available from elsewhere on your $PATH"
234-
*/
235-
printf(_("---------------------------------------"));
236-
mput_char('-', strlen(title));
226+
printf_ln(_("git commands available from elsewhere on your $PATH"));
237227
putchar('\n');
238228
pretty_print_string_list(other_cmds, longest);
239229
putchar('\n');

help.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ extern void add_cmdname(struct cmdnames *cmds, const char *name, int len);
2525
/* Here we require that excludes is a sorted list. */
2626
extern void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
2727
extern int is_in_cmdlist(struct cmdnames *cmds, const char *name);
28-
extern void list_commands(const char *title,
29-
struct cmdnames *main_cmds,
28+
extern void list_commands(struct cmdnames *main_cmds,
3029
struct cmdnames *other_cmds);
3130

3231
#endif /* HELP_H */

0 commit comments

Comments
 (0)