1
0
mirror of https://github.com/git/git.git synced 2024-10-02 11:11:23 +02:00

git-tag: introduce long forms for the options

Long forms are better to memorize and more reliably uniform across
commands.

Design notes:

-u,--local-user is named following the analogous gnupg option.

-l,--list is not an argument taking option but a mode switch.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber 2011-08-28 16:54:29 +02:00 committed by Junio C Hamano
parent afc1692fef
commit c97eff5a95
2 changed files with 21 additions and 10 deletions

@ -43,12 +43,15 @@ GnuPG key for signing.
OPTIONS OPTIONS
------- -------
-a:: -a::
--annotate::
Make an unsigned, annotated tag object Make an unsigned, annotated tag object
-s:: -s::
--sign::
Make a GPG-signed tag, using the default e-mail address's key Make a GPG-signed tag, using the default e-mail address's key
-u <key-id>:: -u <key-id>::
--local-user=<key-id>::
Make a GPG-signed tag, using the given key Make a GPG-signed tag, using the given key
-f:: -f::
@ -56,9 +59,11 @@ OPTIONS
Replace an existing tag with the given name (instead of failing) Replace an existing tag with the given name (instead of failing)
-d:: -d::
--delete::
Delete existing tags with the given names. Delete existing tags with the given names.
-v:: -v::
--verify::
Verify the gpg signature of the given tag names. Verify the gpg signature of the given tag names.
-n<num>:: -n<num>::
@ -69,13 +74,18 @@ OPTIONS
If the tag is not annotated, the commit message is displayed instead. If the tag is not annotated, the commit message is displayed instead.
-l <pattern>:: -l <pattern>::
List tags with names that match the given pattern (or all if no pattern is given). --list <pattern>::
Typing "git tag" without arguments, also lists all tags. List tags with names that match the given pattern (or all if no
pattern is given). Running "git tag" without arguments also
lists all tags. The pattern is a shell wildcard (i.e., matched
using fnmatch(3)). Multiple patterns may be given; if any of
them matches, the tag is shown.
--contains <commit>:: --contains <commit>::
Only list tags which contain the specified commit. Only list tags which contain the specified commit.
-m <msg>:: -m <msg>::
--message=<msg>::
Use the given tag message (instead of prompting). Use the given tag message (instead of prompting).
If multiple `-m` options are given, their values are If multiple `-m` options are given, their values are
concatenated as separate paragraphs. concatenated as separate paragraphs.
@ -83,6 +93,7 @@ OPTIONS
is given. is given.
-F <file>:: -F <file>::
--file=<file>::
Take the tag message from the given file. Use '-' to Take the tag message from the given file. Use '-' to
read the message from the standard input. read the message from the standard input.
Implies `-a` if none of `-a`, `-s`, or `-u <key-id>` Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`

@ -377,21 +377,21 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
struct msg_arg msg = { 0, STRBUF_INIT }; struct msg_arg msg = { 0, STRBUF_INIT };
struct commit_list *with_commit = NULL; struct commit_list *with_commit = NULL;
struct option options[] = { struct option options[] = {
OPT_BOOLEAN('l', NULL, &list, "list tag names"), OPT_BOOLEAN('l', "list", &list, "list tag names"),
{ OPTION_INTEGER, 'n', NULL, &lines, "n", { OPTION_INTEGER, 'n', NULL, &lines, "n",
"print <n> lines of each tag message", "print <n> lines of each tag message",
PARSE_OPT_OPTARG, NULL, 1 }, PARSE_OPT_OPTARG, NULL, 1 },
OPT_BOOLEAN('d', NULL, &delete, "delete tags"), OPT_BOOLEAN('d', "delete", &delete, "delete tags"),
OPT_BOOLEAN('v', NULL, &verify, "verify tags"), OPT_BOOLEAN('v', "verify", &verify, "verify tags"),
OPT_GROUP("Tag creation options"), OPT_GROUP("Tag creation options"),
OPT_BOOLEAN('a', NULL, &annotate, OPT_BOOLEAN('a', "annotate", &annotate,
"annotated tag, needs a message"), "annotated tag, needs a message"),
OPT_CALLBACK('m', NULL, &msg, "message", OPT_CALLBACK('m', "message", &msg, "message",
"tag message", parse_msg_arg), "tag message", parse_msg_arg),
OPT_FILENAME('F', NULL, &msgfile, "read message from file"), OPT_FILENAME('F', "file", &msgfile, "read message from file"),
OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"), OPT_BOOLEAN('s', "sign", &sign, "annotated and GPG-signed tag"),
OPT_STRING('u', NULL, &keyid, "key-id", OPT_STRING('u', "local-user", &keyid, "key-id",
"use another key to sign the tag"), "use another key to sign the tag"),
OPT__FORCE(&force, "replace the tag if exists"), OPT__FORCE(&force, "replace the tag if exists"),