Skip to content

Commit

Permalink
parse-options: multi-word argh should use dash to separate words
Browse files Browse the repository at this point in the history
"When you need to use space, use dash" is a strange way to say that
you must not use a space.  Because it is more common for the command
line descriptions to use dashed-multi-words, you do not even want to
use spaces in these places.  Rephrase the documentation to avoid
this strangeness.

Fix a few existing multi-word argument help strings, i.e.

 - GPG key-ids given to -S/--gpg-sign are "key-id";
 - Refs used for storing notes are "notes-ref"; and
 - Expiry timestamps given to --expire are "expiry-date".

and update the corresponding documentation pages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
gitster committed Mar 24, 2014
1 parent ce7f874 commit e703d71
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Documentation/git-cherry-pick.txt
Expand Up @@ -9,7 +9,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] 'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
[-S[<keyid>]] <commit>... [-S[<key-id>]] <commit>...
'git cherry-pick' --continue 'git cherry-pick' --continue
'git cherry-pick' --quit 'git cherry-pick' --quit
'git cherry-pick' --abort 'git cherry-pick' --abort
Expand Down Expand Up @@ -101,8 +101,8 @@ effect to your index in a row.
--signoff:: --signoff::
Add Signed-off-by line at the end of the commit message. Add Signed-off-by line at the end of the commit message.


-S[<keyid>]:: -S[<key-id>]::
--gpg-sign[=<keyid>]:: --gpg-sign[=<key-id>]::
GPG-sign commits. GPG-sign commits.


--ff:: --ff::
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-commit.txt
Expand Up @@ -13,7 +13,7 @@ SYNOPSIS
[-F <file> | -m <msg>] [--reset-author] [--allow-empty] [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
[--allow-empty-message] [--no-verify] [-e] [--author=<author>] [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
[--date=<date>] [--cleanup=<mode>] [--[no-]status] [--date=<date>] [--cleanup=<mode>] [--[no-]status]
[-i | -o] [-S[<keyid>]] [--] [<file>...] [-i | -o] [-S[<key-id>]] [--] [<file>...]


DESCRIPTION DESCRIPTION
----------- -----------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-merge.txt
Expand Up @@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit] 'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
[-s <strategy>] [-X <strategy-option>] [-S[<keyid>]] [-s <strategy>] [-X <strategy-option>] [-S[<key-id>]]
[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...] [--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
'git merge' <msg> HEAD <commit>... 'git merge' <msg> HEAD <commit>...
'git merge' --abort 'git merge' --abort
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-notes.txt
Expand Up @@ -14,7 +14,7 @@ SYNOPSIS
'git notes' append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] 'git notes' append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>]
'git notes' edit [<object>] 'git notes' edit [<object>]
'git notes' show [<object>] 'git notes' show [<object>]
'git notes' merge [-v | -q] [-s <strategy> ] <notes_ref> 'git notes' merge [-v | -q] [-s <strategy> ] <notes-ref>
'git notes' merge --commit [-v | -q] 'git notes' merge --commit [-v | -q]
'git notes' merge --abort [-v | -q] 'git notes' merge --abort [-v | -q]
'git notes' remove [--ignore-missing] [--stdin] [<object>...] 'git notes' remove [--ignore-missing] [--stdin] [<object>...]
Expand Down
16 changes: 8 additions & 8 deletions Documentation/git-rev-parse.txt
Expand Up @@ -290,14 +290,14 @@ The lines after the separator describe the options.
Each line of options has this format: Each line of options has this format:


------------ ------------
<opt_spec><flags>*<arg_hint>? SP+ help LF <opt-spec><flags>*<arg-hint>? SP+ help LF
------------ ------------


`<opt_spec>`:: `<opt-spec>`::
its format is the short option character, then the long option name its format is the short option character, then the long option name
separated by a comma. Both parts are not required, though at least one separated by a comma. Both parts are not required, though at least one
is necessary. `h,help`, `dry-run` and `f` are all three correct is necessary. `h,help`, `dry-run` and `f` are all three correct
`<opt_spec>`. `<opt-spec>`.


`<flags>`:: `<flags>`::
`<flags>` are of `*`, `=`, `?` or `!`. `<flags>` are of `*`, `=`, `?` or `!`.
Expand All @@ -313,11 +313,11 @@ Each line of options has this format:


* Use `!` to not make the corresponding negated long option available. * Use `!` to not make the corresponding negated long option available.


`<arg_hint>`:: `<arg-hint>`::
`<arg_hint>`, if specified, is used as a name of the argument in the `<arg-hint>`, if specified, is used as a name of the argument in the
help output, for options that take arguments. `<arg_hint>` is help output, for options that take arguments. `<arg-hint>` is
terminated by the first whitespace. When you need to use space in the terminated by the first whitespace. It is customary to use a
argument hint use dash instead. dash to separate words in a multi-word argument hint.


The remainder of the line, after stripping the spaces, is used The remainder of the line, after stripping the spaces, is used
as the help associated to the option. as the help associated to the option.
Expand Down
6 changes: 3 additions & 3 deletions Documentation/git-revert.txt
Expand Up @@ -8,7 +8,7 @@ git-revert - Revert some existing commits
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>... 'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<key-id>]] <commit>...
'git revert' --continue 'git revert' --continue
'git revert' --quit 'git revert' --quit
'git revert' --abort 'git revert' --abort
Expand Down Expand Up @@ -80,8 +80,8 @@ more details.
This is useful when reverting more than one commits' This is useful when reverting more than one commits'
effect to your index in a row. effect to your index in a row.


-S[<keyid>]:: -S[<key-id>]::
--gpg-sign[=<keyid>]:: --gpg-sign[=<key-id>]::
GPG-sign commits. GPG-sign commits.


-s:: -s::
Expand Down
2 changes: 1 addition & 1 deletion builtin/checkout.c
Expand Up @@ -1095,7 +1095,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "detach", &opts.force_detach, N_("detach the HEAD at named commit")), OPT_BOOL(0, "detach", &opts.force_detach, N_("detach the HEAD at named commit")),
OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"), OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"),
BRANCH_TRACK_EXPLICIT), BRANCH_TRACK_EXPLICIT),
OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new branch"), N_("new unparented branch")), OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
OPT_SET_INT('2', "ours", &opts.writeout_stage, N_("checkout our version for unmerged files"), OPT_SET_INT('2', "ours", &opts.writeout_stage, N_("checkout our version for unmerged files"),
2), 2),
OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"), OPT_SET_INT('3', "theirs", &opts.writeout_stage, N_("checkout their version for unmerged files"),
Expand Down
2 changes: 1 addition & 1 deletion builtin/commit.c
Expand Up @@ -1472,7 +1472,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")), OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
OPT_STRING(0, "cleanup", &cleanup_arg, N_("default"), N_("how to strip spaces and #comments from message")), OPT_STRING(0, "cleanup", &cleanup_arg, N_("default"), N_("how to strip spaces and #comments from message")),
OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")), OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key id"), { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" }, N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
/* end commit message options */ /* end commit message options */


Expand Down
2 changes: 1 addition & 1 deletion builtin/merge.c
Expand Up @@ -220,7 +220,7 @@ static struct option builtin_merge_options[] = {
OPT_BOOL(0, "abort", &abort_current_merge, OPT_BOOL(0, "abort", &abort_current_merge,
N_("abort the current in-progress merge")), N_("abort the current in-progress merge")),
OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1), OPT_SET_INT(0, "progress", &show_progress, N_("force progress reporting"), 1),
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key id"), { OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" }, N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")), OPT_BOOL(0, "overwrite-ignore", &overwrite_ignore, N_("update ignored files (default)")),
OPT_END() OPT_END()
Expand Down
2 changes: 1 addition & 1 deletion builtin/notes.c
Expand Up @@ -939,7 +939,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
int result; int result;
const char *override_notes_ref = NULL; const char *override_notes_ref = NULL;
struct option options[] = { struct option options[] = {
OPT_STRING(0, "ref", &override_notes_ref, N_("notes_ref"), OPT_STRING(0, "ref", &override_notes_ref, N_("notes-ref"),
N_("use notes from <notes_ref>")), N_("use notes from <notes_ref>")),
OPT_END() OPT_END()
}; };
Expand Down
2 changes: 1 addition & 1 deletion builtin/revert.c
Expand Up @@ -89,7 +89,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
OPT_STRING(0, "strategy", &opts->strategy, N_("strategy"), N_("merge strategy")), OPT_STRING(0, "strategy", &opts->strategy, N_("strategy"), N_("merge strategy")),
OPT_CALLBACK('X', "strategy-option", &opts, N_("option"), OPT_CALLBACK('X', "strategy-option", &opts, N_("option"),
N_("option for merge strategy"), option_parse_x), N_("option for merge strategy"), option_parse_x),
{ OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key id"), { OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" }, N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_END(), OPT_END(),
OPT_END(), OPT_END(),
Expand Down
2 changes: 1 addition & 1 deletion builtin/tag.c
Expand Up @@ -513,7 +513,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")), OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")),
OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"), OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"),
N_("how to strip spaces and #comments from message")), N_("how to strip spaces and #comments from message")),
OPT_STRING('u', "local-user", &keyid, N_("key id"), OPT_STRING('u', "local-user", &keyid, N_("key-id"),
N_("use another key to sign the tag")), N_("use another key to sign the tag")),
OPT__FORCE(&force, N_("replace the tag if exists")), OPT__FORCE(&force, N_("replace the tag if exists")),
OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")), OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")),
Expand Down
2 changes: 1 addition & 1 deletion parse-options.h
Expand Up @@ -143,7 +143,7 @@ struct option {
{ OPTION_CALLBACK, (s), (l), (v), N_("time"),(h), 0, \ { OPTION_CALLBACK, (s), (l), (v), N_("time"),(h), 0, \
parse_opt_approxidate_cb } parse_opt_approxidate_cb }
#define OPT_EXPIRY_DATE(s, l, v, h) \ #define OPT_EXPIRY_DATE(s, l, v, h) \
{ OPTION_CALLBACK, (s), (l), (v), N_("expiry date"),(h), 0, \ { OPTION_CALLBACK, (s), (l), (v), N_("expiry-date"),(h), 0, \
parse_opt_expiry_date_cb } parse_opt_expiry_date_cb }
#define OPT_CALLBACK(s, l, v, a, h, f) \ #define OPT_CALLBACK(s, l, v, a, h, f) \
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) } { OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
Expand Down

0 comments on commit e703d71

Please sign in to comment.