X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=inline;f=builtin-verify-tag.c;h=9f482c29f516bde84023f401b28b133c1e605333;hb=3e97c7c6af2901cec63bf35fcd43ae3472e24af8;hp=db81496b464e253341a42e01eb72d6845e87199c;hpb=92798702cf6d201f80e257a07d0a0c40565c79fe;p=git.git diff --git a/builtin-verify-tag.c b/builtin-verify-tag.c index db81496b4..9f482c29f 100644 --- a/builtin-verify-tag.c +++ b/builtin-verify-tag.c @@ -10,9 +10,12 @@ #include "tag.h" #include "run-command.h" #include +#include "parse-options.h" -static const char builtin_verify_tag_usage[] = - "git-verify-tag [-v|--verbose] ..."; +static const char * const verify_tag_usage[] = { + "git verify-tag [-v|--verbose] ...", + NULL +}; #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----" @@ -55,7 +58,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose) close(gpg.in); ret = finish_command(&gpg); - unlink(path); + unlink_or_warn(path); return ret; } @@ -89,16 +92,17 @@ static int verify_tag(const char *name, int verbose) int cmd_verify_tag(int argc, const char **argv, const char *prefix) { int i = 1, verbose = 0, had_error = 0; + const struct option verify_tag_options[] = { + OPT__VERBOSE(&verbose), + OPT_END() + }; - git_config(git_default_config); + git_config(git_default_config, NULL); - if (argc == 1) - usage(builtin_verify_tag_usage); - - if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) { - verbose = 1; - i++; - } + argc = parse_options(argc, argv, prefix, verify_tag_options, + verify_tag_usage, PARSE_OPT_KEEP_ARGV0); + if (argc <= i) + usage_with_options(verify_tag_usage, verify_tag_options); /* sometimes the program was terminated because this signal * was received in the process of writing the gpg input: */