@bobfrankston/gcal 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/gcal.ts +35 -2
  2. package/package.json +4 -1
package/gcal.ts CHANGED
@@ -243,6 +243,7 @@ Options:
243
243
  -defaultUser <email> Set default user for future use
244
244
  -c, -calendar <id> Calendar ID (default: primary)
245
245
  -n <count> Number of events to list
246
+ -r, -reminder <time> Reminder before event (10, 30m, 1h, 1d)
246
247
  -v, -verbose Show event IDs and links
247
248
 
248
249
  Examples:
@@ -251,7 +252,7 @@ Examples:
251
252
  gcal add "Dentist" "Friday 3pm" "1h"
252
253
  gcal add "Lunch" "1/14/2026 12:00" "1h"
253
254
  gcal add "Meeting" "tomorrow 10:00"
254
- gcal add "Appointment" "jan 15 2pm"
255
+ gcal add "Appointment" "jan 15 2pm" -r 1h
255
256
  gcal -defaultUser bob@gmail.com Set default user
256
257
 
257
258
  File Association (Windows):
@@ -270,6 +271,20 @@ interface ParsedArgs {
270
271
  help: boolean;
271
272
  verbose: boolean;
272
273
  icsFile: string; /** Direct .ics file path */
274
+ reminder: number; /** Reminder in minutes, -1 = not set */
275
+ }
276
+
277
+ /** Parse reminder string: number (minutes), or suffix m/h/d */
278
+ function parseReminder(val: string): number {
279
+ const match = val.match(/^(\d+)(m|h|d)?$/i);
280
+ if (!match) return -1;
281
+ const num = parseInt(match[1]);
282
+ const unit = (match[2] || 'm').toLowerCase();
283
+ switch (unit) {
284
+ case 'h': return num * 60;
285
+ case 'd': return num * 60 * 24;
286
+ default: return num;
287
+ }
273
288
  }
274
289
 
275
290
  function parseArgs(argv: string[]): ParsedArgs {
@@ -282,7 +297,8 @@ function parseArgs(argv: string[]): ParsedArgs {
282
297
  count: 10,
283
298
  help: false,
284
299
  verbose: false,
285
- icsFile: ''
300
+ icsFile: '',
301
+ reminder: -1
286
302
  };
287
303
 
288
304
  const unknown: string[] = [];
@@ -312,6 +328,11 @@ function parseArgs(argv: string[]): ParsedArgs {
312
328
  case '--verbose':
313
329
  result.verbose = true;
314
330
  break;
331
+ case '-r':
332
+ case '-reminder':
333
+ case '--reminder':
334
+ result.reminder = parseReminder(argv[++i] || '');
335
+ break;
315
336
  case '-h':
316
337
  case '-help':
317
338
  case '--help':
@@ -551,10 +572,22 @@ async function main(): Promise<void> {
551
572
  }
552
573
  };
553
574
 
575
+ if (parsed.reminder >= 0) {
576
+ event.reminders = {
577
+ useDefault: false,
578
+ overrides: [{ method: 'popup', minutes: parsed.reminder }]
579
+ };
580
+ }
581
+
554
582
  const token = await getAccessToken(user, true);
555
583
  const created = await createEvent(token, event, parsed.calendar);
556
584
  console.log(`\nEvent created: ${created.summary}`);
557
585
  console.log(` When: ${formatDateTime(created.start)} - ${formatDateTime(created.end)}`);
586
+ if (parsed.reminder >= 0) {
587
+ const mins = parsed.reminder;
588
+ const reminderStr = mins >= 1440 ? `${mins / 1440}d` : mins >= 60 ? `${mins / 60}h` : `${mins}m`;
589
+ console.log(` Reminder: ${reminderStr} before`);
590
+ }
558
591
  if (created.htmlLink) {
559
592
  console.log(` Link: ${created.htmlLink}`);
560
593
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/gcal",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Google Calendar CLI tool with ICS import support",
5
5
  "type": "module",
6
6
  "main": "gcal.ts",
@@ -43,6 +43,9 @@
43
43
  "@bobfrankston/oauthsupport": "^1.0.5",
44
44
  "ical.js": "^2.1.0"
45
45
  },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
46
49
  ".dependencies": {
47
50
  "@bobfrankston/oauthsupport": "file:../../../projects/OAuth/OauthSupport",
48
51
  "ical.js": "^2.1.0"