Changed the --begin and --end switches to rely on interval parsing to
determine the beginning and ending of their range. Also, the ending is now inclusive.
This commit is contained in:
parent
ed63481f3b
commit
b40006f450
1 changed files with 18 additions and 2 deletions
20
config.cc
20
config.cc
|
|
@ -615,18 +615,34 @@ OPT_BEGIN(account, "a:") {
|
||||||
// Report filtering
|
// Report filtering
|
||||||
|
|
||||||
OPT_BEGIN(begin, "b:") {
|
OPT_BEGIN(begin, "b:") {
|
||||||
|
char buf[128];
|
||||||
|
interval_t interval(optarg);
|
||||||
|
if (interval.begin)
|
||||||
|
std::strftime(buf, 127, formats[0], std::localtime(&interval.begin));
|
||||||
|
else
|
||||||
|
throw error(std::string("Could not determine beginning of period '") +
|
||||||
|
optarg + "'");
|
||||||
|
|
||||||
if (! config.predicate.empty())
|
if (! config.predicate.empty())
|
||||||
config.predicate += "&";
|
config.predicate += "&";
|
||||||
config.predicate += "d>=[";
|
config.predicate += "d>=[";
|
||||||
config.predicate += optarg;
|
config.predicate += buf;
|
||||||
config.predicate += "]";
|
config.predicate += "]";
|
||||||
} OPT_END(begin);
|
} OPT_END(begin);
|
||||||
|
|
||||||
OPT_BEGIN(end, "e:") {
|
OPT_BEGIN(end, "e:") {
|
||||||
|
char buf[128];
|
||||||
|
interval_t interval(optarg);
|
||||||
|
if (interval.end)
|
||||||
|
std::strftime(buf, 127, formats[0], std::localtime(&interval.end));
|
||||||
|
else
|
||||||
|
throw error(std::string("Could not determine end of period '") +
|
||||||
|
optarg + "'");
|
||||||
|
|
||||||
if (! config.predicate.empty())
|
if (! config.predicate.empty())
|
||||||
config.predicate += "&";
|
config.predicate += "&";
|
||||||
config.predicate += "d<[";
|
config.predicate += "d<[";
|
||||||
config.predicate += optarg;
|
config.predicate += buf;
|
||||||
config.predicate += "]";
|
config.predicate += "]";
|
||||||
} OPT_END(end);
|
} OPT_END(end);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue