summaryrefslogtreecommitdiff
path: root/src/args.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-02-05 09:15:01 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-02-05 19:06:54 +0100
commite9c8197e4ed1f516c41f803b9aa79bcfe7c7a7ab (patch)
tree80660f846491bfa750a4e425d9caf7ab2b571cc3 /src/args.c
parent8bdf0c0b3b8870157f50554ea51d4751d0b7efa9 (diff)
downloadcalcurse-e9c8197e4ed1f516c41f803b9aa79bcfe7c7a7ab.zip
Refactor grep mode
Split io_save_{apts,todo}() into functions that write raw data to a file and functions that write formatted items to stdout such that one can easily extend the grep mode for format string support in a follow-up commit. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/args.c')
-rw-r--r--src/args.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/args.c b/src/args.c
index d6d2e21..f6f47a5 100644
--- a/src/args.c
+++ b/src/args.c
@@ -727,8 +727,13 @@ int parse_args(int argc, char **argv)
vars_init();
config_load(); /* To get output date format. */
io_load_data(&filter);
- io_save_todo(grep_filter ? path_todo : NULL);
- io_save_apts(grep_filter ? path_apts : NULL);
+ if (grep_filter) {
+ io_save_todo(path_todo);
+ io_save_apts(path_apts);
+ } else {
+ io_dump_todo("%(raw)");
+ io_dump_apts("%(raw)", "%(raw)", "%(raw)", "%(raw)");
+ }
} else if (query) {
io_check_file(path_apts);
io_check_file(path_todo);