]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-options API users: align usage output in C-strings
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 13 Sep 2021 00:13:19 +0000 (02:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Sep 2021 01:57:30 +0000 (18:57 -0700)
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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-remote.c
builtin/show-branch.c
builtin/stash.c
builtin/tag.c

index f4fd823af831a3b8682d9845ee1dba901f3f0dc5..318949c3d75327d5adf9524f3f550548f89a20d2 100644 (file)
@@ -7,8 +7,8 @@
 
 static const char * const ls_remote_usage[] = {
        N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-          "                     [-q | --quiet] [--exit-code] [--get-url]\n"
-          "                     [--symref] [<repository> [<refs>...]]"),
+          "              [-q | --quiet] [--exit-code] [--get-url]\n"
+          "              [--symref] [<repository> [<refs>...]]"),
        NULL
 };
 
index bea4bbf46808df826f7aa36cb8259eb86e634e05..082449293b56388456520cbc67ef873ed3dc767a 100644 (file)
@@ -11,9 +11,9 @@
 
 static const char* show_branch_usage[] = {
     N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
-       "               [--current] [--color[=<when>] | --no-color] [--sparse]\n"
-       "               [--more=<n> | --list | --independent | --merge-base]\n"
-       "               [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"),
+       "                [--current] [--color[=<when>] | --no-color] [--sparse]\n"
+       "                [--more=<n> | --list | --independent | --merge-base]\n"
+       "                [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"),
     N_("git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"),
     NULL
 };
index 8f42360ca91385387a3da84c948023e0a3b06574..45b19007d7c1411b864ee9f8e60d05494d6e9e24 100644 (file)
@@ -85,7 +85,7 @@ static const char * const git_stash_push_usage[] = {
 
 static const char * const git_stash_save_usage[] = {
        N_("git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-          "          [-u|--include-untracked] [-a|--all] [<message>]"),
+          "               [-u|--include-untracked] [-a|--all] [<message>]"),
        NULL
 };
 
index 065b6bf093ee2e5fd3bab88d9427b93a385ce48c..6535ed27ee9e6b419c67349dd470af02265586b3 100644 (file)
 
 static const char * const git_tag_usage[] = {
        N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-               "\t\t<tagname> [<head>]"),
+          "        <tagname> [<head>]"),
        N_("git tag -d <tagname>..."),
        N_("git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--points-at <object>]\n"
-               "\t\t[--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
+          "        [--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
        N_("git tag -v [--format=<format>] <tagname>..."),
        NULL
 };