summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-05 11:36:15 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-05 13:34:24 -0700
commitc785ceaf4cb4032dafb832d27caba419d5be1adc (patch)
treef8dca91e6ee97fb3db713464b4c8cc60006b77ba /main.c
parent88e679ab1df89b2b14f40f4566095d5a01439c05 (diff)
downloadsubsurface-c785ceaf4cb4032dafb832d27caba419d5be1adc.tar.gz
Add an '--import' command line option
This option indicates that all files that come AFTER it on the command line are being added to our divelist. The dives in these files should receive numbers (assuming they are un-numbered and are all newer then the dives in the files before the --import option, and assuming those dives are numbered). This also marks the dive_list changed after the new dives are added. Using this option gives us a reasonable user experience in the case where a user has one file with all their dives and wants to add newer dives after this (after extracting them from a dive computer - as in the case of a uemis owner where there is no direct import from the dive computer, yet). Something like subsurface MyDives.xml --import NewDives.SDA It also doesn't break Linus' vision where the user has many files on the command line which don't imply a changed dive_list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index a09bfe03a..642e07271 100644
--- a/main.c
+++ b/main.c
@@ -155,6 +155,15 @@ static void parse_argument(const char *arg)
case 'v':
verbose++;
continue;
+ case '-':
+ /* long options with -- */
+ if (strcmp(arg,"--import") == 0) {
+ /* mark the dives so far as the base,
+ * everything after is imported */
+ report_dives();
+ return;
+ }
+ /* fallthrough */
default:
fprintf(stderr, "Bad argument '%s'\n", arg);
exit(1);