summaryrefslogtreecommitdiff
path: root/src/args.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/args.c')
-rw-r--r--src/args.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/args.c b/src/args.c
index 4743067..3834f4a 100644
--- a/src/args.c
+++ b/src/args.c
@@ -70,7 +70,7 @@ enum {
OPT_FMT_EV,
OPT_FMT_REV,
OPT_FMT_TODO,
- OPT_LIST_IMPORTED,
+ OPT_DUMP_IMPORTED,
OPT_EXPORT_UID,
OPT_READ_ONLY,
OPT_STATUS,
@@ -402,7 +402,7 @@ int parse_args(int argc, char **argv)
const char *fmt_todo = NULL;
/* Import and export parameters */
int xfmt = IO_EXPORT_ICAL;
- int list_imported = 0, export_uid = 0;
+ int dump_imported = 0, export_uid = 0;
/* Data file locations */
const char *cfile = NULL, *datadir = NULL, *ifile = NULL;
@@ -459,7 +459,7 @@ int parse_args(int argc, char **argv)
{"format-recur-event", required_argument, NULL, OPT_FMT_REV},
{"format-todo", required_argument, NULL, OPT_FMT_TODO},
{"export-uid", no_argument, NULL, OPT_EXPORT_UID},
- {"list-imported", no_argument, NULL, OPT_LIST_IMPORTED},
+ {"dump-imported", no_argument, NULL, OPT_DUMP_IMPORTED},
{"read-only", no_argument, NULL, OPT_READ_ONLY},
{"status", no_argument, NULL, OPT_STATUS},
{"daemon", no_argument, NULL, OPT_DAEMON},
@@ -669,8 +669,8 @@ int parse_args(int argc, char **argv)
case OPT_FMT_TODO:
fmt_todo = optarg;
break;
- case OPT_LIST_IMPORTED:
- list_imported = 1;
+ case OPT_DUMP_IMPORTED:
+ dump_imported = 1;
break;
case OPT_EXPORT_UID:
export_uid = 1;
@@ -776,7 +776,24 @@ int parse_args(int argc, char **argv)
/* Get default pager in case we need to show a log file. */
vars_init();
io_load_data(NULL);
- io_import_data(IO_IMPORT_ICAL, ifile, list_imported);
+ if (dump_imported) {
+ /*
+ * Use default values for non-specified format strings.
+ */
+ fmt_apt = fmt_apt ? fmt_apt : "%(raw)";
+ fmt_rapt = fmt_rapt ? fmt_rapt : "%(raw)";
+ fmt_ev = fmt_ev ? fmt_ev : "%(raw)";
+ fmt_rev = fmt_rev ? fmt_rev : "%(raw)";
+ fmt_todo = fmt_todo ? fmt_todo : "%(raw)";
+ } else {
+ /*
+ * Do not dump items, unset format strings explicitly.
+ */
+ fmt_apt = fmt_rapt = fmt_ev = fmt_rev = NULL;
+ fmt_todo = NULL;
+ }
+ io_import_data(IO_IMPORT_ICAL, ifile, fmt_ev, fmt_rev, fmt_apt,
+ fmt_rapt, fmt_todo);
io_save_apts(path_apts);
io_save_todo(path_todo);
} else if (export) {