Skip to content

Commit 5d70198

Browse files
avargitster
authored andcommitted
parse-options API users: align usage output in C-strings
In preparation for having continued usage lines properly aligned in "git <cmd> -h" output, let's have the "[" on the second such lines align with the "[" on the first line. In some cases this makes the output worse, because e.g. the "git ls-remote -h" output had been aligned to account for the extra whitespace that the usage_with_options_internal() function in parse-options.c would add. In other cases such as builtin/stash.c (not changed here), we were aligned in the C strings, but since that didn't account for the extra padding in usage_with_options_internal() it would come out looking misaligned, e.g. code like this: N_("git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n" " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n" Would emit: or: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet] [-u|--include-untracked] [-a|--all] [-m|--message <message>] Let's change all the usage arrays which use such continued usage output via "\n"-embedding to be like builtin/stash.c. This makes the output worse temporarily, but in a subsequent change I'll improve the usage_with_options_internal() to take this into account, at which point all of the strings being changed here will emit prettier output. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8b7c11b commit 5d70198

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

builtin/ls-remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
static const char * const ls_remote_usage[] = {
99
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
10-
" [-q | --quiet] [--exit-code] [--get-url]\n"
11-
" [--symref] [<repository> [<refs>...]]"),
10+
" [-q | --quiet] [--exit-code] [--get-url]\n"
11+
" [--symref] [<repository> [<refs>...]]"),
1212
NULL
1313
};
1414

builtin/show-branch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
static const char* show_branch_usage[] = {
1313
N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
14-
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
15-
" [--more=<n> | --list | --independent | --merge-base]\n"
16-
" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"),
14+
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
15+
" [--more=<n> | --list | --independent | --merge-base]\n"
16+
" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"),
1717
N_("git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"),
1818
NULL
1919
};

builtin/stash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static const char * const git_stash_push_usage[] = {
8585

8686
static const char * const git_stash_save_usage[] = {
8787
N_("git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
88-
" [-u|--include-untracked] [-a|--all] [<message>]"),
88+
" [-u|--include-untracked] [-a|--all] [<message>]"),
8989
NULL
9090
};
9191

builtin/tag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
static const char * const git_tag_usage[] = {
2525
N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
26-
"\t\t<tagname> [<head>]"),
26+
" <tagname> [<head>]"),
2727
N_("git tag -d <tagname>..."),
2828
N_("git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--points-at <object>]\n"
29-
"\t\t[--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
29+
" [--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
3030
N_("git tag -v [--format=<format>] <tagname>..."),
3131
NULL
3232
};

0 commit comments

Comments
 (0)