Add calendar command line flags
authorAndy Spencer <andy753421@gmail.com>
Sun, 27 Nov 2016 04:49:33 +0000 (04:49 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 28 Nov 2016 09:54:02 +0000 (09:54 +0000)
cals/ical.c
src/args.c

index 8e51a86..b21cad0 100644 (file)
@@ -288,7 +288,6 @@ void ical_config(const char *group, const char *name, const char *key, const cha
                        last->next = cal;
                else
                        calendars = cal;
-               return;
        }
 
        /* Set calendar values */
index 1fceff6..d7a6c68 100644 (file)
@@ -45,7 +45,7 @@ static int print_week = 0;
 static void usage(char *name)
 {
        printf("Usage:\n");
-       printf("  %s [OPTION...]\n", name);
+       printf("  %s [OPTION...] [CALENDAR]\n", name);
        printf("\n");
        printf("Options:\n");
        printf("  -h, --help  Print usage information\n");
@@ -83,6 +83,10 @@ void args_init(void)
                }
        }
 
+       /* Load calendars */
+       for (int i = optind; i < argc; i++)
+               cal_config("ical", argv[i], "location", argv[i]);
+
        /* Validate arguments */
        if (print_day && print_week)
                error("Cannot print both day and week");