From 8a09e6c5f9010ac7159ef39a03b9a36bf233eaca Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 18 Apr 2013 09:46:35 +0200 Subject: api-parse-options.txt: document "no-" for non-boolean options Document that the "no-" prefix can also be used for non-boolean options. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- Documentation/technical/api-parse-options.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation/technical') diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt index 3062389404..facc8c8c49 100644 --- a/Documentation/technical/api-parse-options.txt +++ b/Documentation/technical/api-parse-options.txt @@ -41,6 +41,8 @@ The parse-options API allows: * Boolean long options can be 'negated' (or 'unset') by prepending `no-`, e.g. `--no-abbrev` instead of `--abbrev`. Conversely, options that begin with `no-` can be 'negated' by removing it. + Other long options can be unset (e.g., set string to NULL, set + integer to 0) by prepending `no-`. * Options and non-option arguments can clearly be separated using the `--` option, e.g. `-a -b --option -- --this-is-a-file` indicates that -- cgit v1.3 From 27ec394a9701675762f02e9af464be2c297c6cf1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 25 Apr 2013 11:13:49 -0700 Subject: prune: introduce OPT_EXPIRY_DATE() and use it Earlier we added support for --expire=all (or --expire=now) that considers all crufts, regardless of their age, as eligible for garbage collection by turning command argument parsers that use approxidate() to use parse_expiry_date(), but "git prune" used a built-in parse-options facility OPT_DATE() and did not benefit from the new function. Signed-off-by: Junio C Hamano --- Documentation/technical/api-parse-options.txt | 4 ++++ builtin/prune.c | 4 ++-- parse-options-cb.c | 6 ++++++ parse-options.h | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) (limited to 'Documentation/technical') diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt index facc8c8c49..a8bae69e6e 100644 --- a/Documentation/technical/api-parse-options.txt +++ b/Documentation/technical/api-parse-options.txt @@ -176,6 +176,10 @@ There are some macros to easily define options: Introduce an option with date argument, see `approxidate()`. The timestamp is put into `int_var`. +`OPT_EXPIRY_DATE(short, long, &int_var, description)`:: + Introduce an option with expiry date argument, see `parse_expiry_date()`. + The timestamp is put into `int_var`. + `OPT_CALLBACK(short, long, &var, arg_str, description, func_ptr)`:: Introduce an option with argument. The argument will be fed into the function given by `func_ptr` diff --git a/builtin/prune.c b/builtin/prune.c index 85843d4f17..b90e5cc361 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -132,8 +132,8 @@ int cmd_prune(int argc, const char **argv, const char *prefix) OPT__DRY_RUN(&show_only, N_("do not remove, show only")), OPT__VERBOSE(&verbose, N_("report pruned objects")), OPT_BOOL(0, "progress", &show_progress, N_("show progress")), - OPT_DATE(0, "expire", &expire, - N_("expire objects older than