aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-12 18:40:40 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-13 17:39:44 +0100
commit3eae7ce82869dd2c313496913bb94438dd0177a9 (patch)
treeb409a90240f11871e0f0fffab81dbfcbf206240f /src/args.c
parentc58087d5914322ab8f693729605a9508d67bb676 (diff)
downloadcalcurse-3eae7ce82869dd2c313496913bb94438dd0177a9.tar.gz
calcurse-3eae7ce82869dd2c313496913bb94438dd0177a9.zip
Add --list-imported command line option
When this option is used together with -i/--import, the object identifiers of imported objects are printed to stdout. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/args.c')
-rw-r--r--src/args.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/args.c b/src/args.c
index 78a7058..0e6a5a2 100644
--- a/src/args.c
+++ b/src/args.c
@@ -70,6 +70,7 @@ enum {
OPT_FMT_EV,
OPT_FMT_REV,
OPT_FMT_TODO,
+ OPT_LIST_IMPORTED,
OPT_READ_ONLY,
OPT_STATUS
};
@@ -452,6 +453,7 @@ int parse_args(int argc, char **argv)
const char *fmt_todo = "%p. %m\n";
/* Import and export parameters */
int xfmt = IO_EXPORT_ICAL;
+ int list_imported = 0;
/* Data file locations */
const char *cfile = NULL, *datadir = NULL, *ifile = NULL;
@@ -507,6 +509,7 @@ int parse_args(int argc, char **argv)
{"format-event", required_argument, NULL, OPT_FMT_EV},
{"format-recur-event", required_argument, NULL, OPT_FMT_REV},
{"format-todo", required_argument, NULL, OPT_FMT_TODO},
+ {"list-imported", no_argument, NULL, OPT_LIST_IMPORTED},
{"read-only", no_argument, NULL, OPT_READ_ONLY},
{"status", no_argument, NULL, OPT_STATUS},
{NULL, no_argument, NULL, 0}
@@ -713,6 +716,9 @@ int parse_args(int argc, char **argv)
case OPT_FMT_TODO:
fmt_todo = optarg;
break;
+ case OPT_LIST_IMPORTED:
+ list_imported = 1;
+ break;
case OPT_READ_ONLY:
read_only = 1;
break;
@@ -789,7 +795,7 @@ 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);
+ io_import_data(IO_IMPORT_ICAL, ifile, list_imported);
io_save_apts(path_apts);
io_save_todo(path_todo);
} else if (export) {