@matheusbsbs / matheus-bagliano / commits / 4855b2a220
Fork 0

verify-tag: migrate to parse-options

Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Boyd committed Jul 7, 2009 at 22:15 UTC 4855b2a220cacb01b77a2bf431b5b176bfa1d732
1 file changed +12 -9
builtin-verify-tag.c
+12 -9
@@ -10,9 +10,12 @@
10 #include "tag.h"
11 #include "run-command.h"
12 #include <signal.h>
13 +#include "parse-options.h"
14
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 +};
19
20 #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
21
@@ -89,17 +92,17 @@ static int verify_tag(const char *name, int verbose)
92 int cmd_verify_tag(int argc, const char **argv, const char *prefix)
93 {
94 int i = 1, verbose = 0, had_error = 0;
95 + const struct option verify_tag_options[] = {
96 + OPT__VERBOSE(&verbose),
97 + OPT_END()
98 + };
99
100 git_config(git_default_config, NULL);
101
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);
104 if (argc <= i)
102 - usage(builtin_verify_tag_usage);
105 + usage_with_options(verify_tag_usage, verify_tag_options);
106
107 /* sometimes the program was terminated because this signal
108 * was received in the process of writing the gpg input: */