Skip to content

Commit 4855b2a

Browse files
bebarinogitster
authored andcommitted
verify-tag: migrate to parse-options
Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 404d42e commit 4855b2a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

builtin-verify-tag.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
#include "tag.h"
1111
#include "run-command.h"
1212
#include <signal.h>
13+
#include "parse-options.h"
1314

14-
static const char builtin_verify_tag_usage[] =
15-
"git verify-tag [-v|--verbose] <tag>...";
15+
static const char * const verify_tag_usage[] = {
16+
"git verify-tag [-v|--verbose] <tag>...",
17+
NULL
18+
};
1619

1720
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
1821

@@ -89,17 +92,17 @@ static int verify_tag(const char *name, int verbose)
8992
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
9093
{
9194
int i = 1, verbose = 0, had_error = 0;
95+
const struct option verify_tag_options[] = {
96+
OPT__VERBOSE(&verbose),
97+
OPT_END()
98+
};
9299

93100
git_config(git_default_config, NULL);
94101

95-
if (argc > 1 &&
96-
(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose"))) {
97-
verbose = 1;
98-
i++;
99-
}
100-
102+
argc = parse_options(argc, argv, prefix, verify_tag_options,
103+
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
101104
if (argc <= i)
102-
usage(builtin_verify_tag_usage);
105+
usage_with_options(verify_tag_usage, verify_tag_options);
103106

104107
/* sometimes the program was terminated because this signal
105108
* was received in the process of writing the gpg input: */

0 commit comments

Comments
 (0)