Filter by time-span in export.

This commit is contained in:
tastytea 2019-05-16 00:26:48 +02:00
parent 2c27a352a2
commit b6dffa9c7b
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 8 additions and 7 deletions

View File

@ -2,7 +2,7 @@
:doctype: manpage
:Author: tastytea
:Email: tastytea@tastytea.de
:Date: 2019-05-14
:Date: 2019-05-16
:Revision: 0.0.0
:man source: remwharead
:man manual: General Commands Manual
@ -35,9 +35,9 @@ Export to _format_. Possible values are _csv_ and _asciidoc_.
Save output to _file_. Default is stdout.
*-s* _start_,_end_, *--span* _start_,_end_::
Only export entries between _start_ and _end_. _start_ and _end_ are date and
time representations according to ISO 8601. Time zones are ignored at the
moment.
Only export entries between and including _start_ and _end_. _start_ and _end_
are date and time representations according to ISO 8601. Time zones are ignored
at the moment. Example: `--span 2019-01-01,2019-02-10T12:30`.
*-S* _attribute_, *--sort* _attribute_::
Sort by _time_, _tag_ or _both_ (default) when exporting to _asciidoc_.

View File

@ -55,7 +55,8 @@ int main(const int argc, const char *argv[])
{
case export_format::csv:
{
for (const Database::entry &entry : db.retrieve())
for (const Database::entry &entry
: db.retrieve(opts.span[0], opts.span[1]))
{
string strtags;
for (const string &tag : entry.tags)
@ -75,7 +76,7 @@ int main(const int argc, const char *argv[])
}
case export_format::asciidoc:
{
cerr << "AsciiDoc is not yet supported.\n";
cerr << "Error: AsciiDoc is not yet supported.\n";
break;
}
default:

View File

@ -37,7 +37,7 @@ typedef struct options
vector<string> tags;
export_format format = export_format::undefined;
string file;
array<time_point, 2> span;
array<time_point, 2> span = { time_point(), system_clock::now() };
sort_attribute sort = sort_attribute::both;
string url;
uint8_t status_code = 0;