verify-tag: migrate to parse-options
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
404d42e5ef
commit
4855b2a220
@ -10,9 +10,12 @@
|
|||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include "parse-options.h"
|
||||||
|
|
||||||
static const char builtin_verify_tag_usage[] =
|
static const char * const verify_tag_usage[] = {
|
||||||
"git verify-tag [-v|--verbose] <tag>...";
|
"git verify-tag [-v|--verbose] <tag>...",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
||||||
|
|
||||||
@ -89,17 +92,17 @@ static int verify_tag(const char *name, int verbose)
|
|||||||
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
|
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i = 1, verbose = 0, had_error = 0;
|
int i = 1, verbose = 0, had_error = 0;
|
||||||
|
const struct option verify_tag_options[] = {
|
||||||
|
OPT__VERBOSE(&verbose),
|
||||||
|
OPT_END()
|
||||||
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
git_config(git_default_config, NULL);
|
||||||
|
|
||||||
if (argc > 1 &&
|
argc = parse_options(argc, argv, prefix, verify_tag_options,
|
||||||
(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose"))) {
|
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
|
||||||
verbose = 1;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc <= i)
|
if (argc <= i)
|
||||||
usage(builtin_verify_tag_usage);
|
usage_with_options(verify_tag_usage, verify_tag_options);
|
||||||
|
|
||||||
/* sometimes the program was terminated because this signal
|
/* sometimes the program was terminated because this signal
|
||||||
* was received in the process of writing the gpg input: */
|
* was received in the process of writing the gpg input: */
|
||||||
|
Reference in New Issue
Block a user