summaryrefslogtreecommitdiff
path: root/builtin-prune-packed.c
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2009-07-07 22:15:41 -0700
committerJunio C Hamano <gitster@pobox.com>2009-07-10 23:57:21 -0700
commit7cfe0c9802d6d6c915cba91b73a591622dbcbc93 (patch)
treea4dd2f6aa60fc74dd7e063b6316adfdee737de92 /builtin-prune-packed.c
parentc9c3c6781c5b97c37b3ce16af7ea9bc613413c7e (diff)
downloadgit-7cfe0c9802d6d6c915cba91b73a591622dbcbc93.tar.gz
prune-packed: migrate to parse-options
Add long options for dry run and quiet to be more consistent with the rest of git. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-prune-packed.c')
-rw-r--r--builtin-prune-packed.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 00590b1c3c..be99eb0ac4 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -1,9 +1,12 @@
#include "builtin.h"
#include "cache.h"
#include "progress.h"
+#include "parse-options.h"
-static const char prune_packed_usage[] =
-"git prune-packed [-n] [-q]";
+static const char * const prune_packed_usage[] = {
+ "git prune-packed [-n|--dry-run] [-q|--quiet]",
+ NULL
+};
#define DRY_RUN 01
#define VERBOSE 02
@@ -68,24 +71,16 @@ void prune_packed_objects(int opts)
int cmd_prune_packed(int argc, const char **argv, const char *prefix)
{
- int i;
int opts = VERBOSE;
+ const struct option prune_packed_options[] = {
+ OPT_BIT('n', "dry-run", &opts, "dry run", DRY_RUN),
+ OPT_NEGBIT('q', "quiet", &opts, "be quiet", VERBOSE),
+ OPT_END()
+ };
- for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
+ argc = parse_options(argc, argv, prefix, prune_packed_options,
+ prune_packed_usage, 0);
- if (*arg == '-') {
- if (!strcmp(arg, "-n"))
- opts |= DRY_RUN;
- else if (!strcmp(arg, "-q"))
- opts &= ~VERBOSE;
- else
- usage(prune_packed_usage);
- continue;
- }
- /* Handle arguments here .. */
- usage(prune_packed_usage);
- }
prune_packed_objects(opts);
return 0;
}