@ncukondo/gcal-cli 0.1.5 → 0.1.7
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.
- package/dist/index.js +55 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -587718,7 +587718,7 @@ function errorCodeToExitCode(code) {
|
|
|
587718
587718
|
// package.json
|
|
587719
587719
|
var package_default = {
|
|
587720
587720
|
name: "@ncukondo/gcal-cli",
|
|
587721
|
-
version: "0.1.
|
|
587721
|
+
version: "0.1.7",
|
|
587722
587722
|
type: "module",
|
|
587723
587723
|
exports: {
|
|
587724
587724
|
".": "./dist/index.js"
|
|
@@ -591822,6 +591822,43 @@ async function handleUpdate(opts) {
|
|
|
591822
591822
|
withTime.allDay = false;
|
|
591823
591823
|
input.timeZone = timezone;
|
|
591824
591824
|
}
|
|
591825
|
+
if (opts.dryRun) {
|
|
591826
|
+
const changes = {};
|
|
591827
|
+
if (input.title !== undefined)
|
|
591828
|
+
changes.title = input.title;
|
|
591829
|
+
if (input.description !== undefined)
|
|
591830
|
+
changes.description = input.description;
|
|
591831
|
+
if (input.transparency !== undefined)
|
|
591832
|
+
changes.transparency = input.transparency;
|
|
591833
|
+
const withTime = input;
|
|
591834
|
+
if (withTime.start !== undefined)
|
|
591835
|
+
changes.start = withTime.start;
|
|
591836
|
+
if (withTime.end !== undefined)
|
|
591837
|
+
changes.end = withTime.end;
|
|
591838
|
+
if (format3 === "json") {
|
|
591839
|
+
write(formatJsonSuccess({
|
|
591840
|
+
dry_run: true,
|
|
591841
|
+
action: "update",
|
|
591842
|
+
event_id: eventId,
|
|
591843
|
+
changes
|
|
591844
|
+
}));
|
|
591845
|
+
} else {
|
|
591846
|
+
const lines = [`DRY RUN: Would update event "${eventId}":`];
|
|
591847
|
+
if (changes.title !== undefined)
|
|
591848
|
+
lines.push(` title: "${changes.title}"`);
|
|
591849
|
+
if (changes.start !== undefined)
|
|
591850
|
+
lines.push(` start: "${changes.start}"`);
|
|
591851
|
+
if (changes.end !== undefined)
|
|
591852
|
+
lines.push(` end: "${changes.end}"`);
|
|
591853
|
+
if (changes.description !== undefined)
|
|
591854
|
+
lines.push(` description: "${changes.description}"`);
|
|
591855
|
+
if (changes.transparency !== undefined)
|
|
591856
|
+
lines.push(` transparency: ${changes.transparency}`);
|
|
591857
|
+
write(lines.join(`
|
|
591858
|
+
`));
|
|
591859
|
+
}
|
|
591860
|
+
return { exitCode: ExitCode.SUCCESS };
|
|
591861
|
+
}
|
|
591825
591862
|
const updated = await updateEvent(api2, calendarId, calendarName, eventId, input);
|
|
591826
591863
|
if (format3 === "json") {
|
|
591827
591864
|
write(formatJsonSuccess({ event: updated }));
|
|
@@ -591839,6 +591876,7 @@ function createUpdateCommand() {
|
|
|
591839
591876
|
cmd.option("-d, --description <text>", "New description");
|
|
591840
591877
|
cmd.option("--busy", "Mark as busy");
|
|
591841
591878
|
cmd.option("--free", "Mark as free");
|
|
591879
|
+
cmd.option("--dry-run", "Preview without executing");
|
|
591842
591880
|
const busyOpt = cmd.options.find((o) => o.long === "--busy");
|
|
591843
591881
|
const freeOpt = cmd.options.find((o) => o.long === "--free");
|
|
591844
591882
|
busyOpt.conflicts(["free"]);
|
|
@@ -591920,11 +591958,24 @@ function createAddCommand() {
|
|
|
591920
591958
|
|
|
591921
591959
|
// src/commands/delete.ts
|
|
591922
591960
|
async function handleDelete(opts) {
|
|
591923
|
-
const { api: api2, eventId, calendarId, format: format3, quiet, write } = opts;
|
|
591961
|
+
const { api: api2, eventId, calendarId, format: format3, quiet, dryRun = false, write } = opts;
|
|
591924
591962
|
if (!eventId) {
|
|
591925
591963
|
write(formatJsonError("INVALID_ARGS", "event-id is required"));
|
|
591926
591964
|
return { exitCode: ExitCode.ARGUMENT };
|
|
591927
591965
|
}
|
|
591966
|
+
if (dryRun) {
|
|
591967
|
+
if (format3 === "json") {
|
|
591968
|
+
write(formatJsonSuccess({
|
|
591969
|
+
dry_run: true,
|
|
591970
|
+
action: "delete",
|
|
591971
|
+
event_id: eventId,
|
|
591972
|
+
calendar_id: calendarId
|
|
591973
|
+
}));
|
|
591974
|
+
} else {
|
|
591975
|
+
write(`DRY RUN: Would delete event "${eventId}" from calendar "${calendarId}"`);
|
|
591976
|
+
}
|
|
591977
|
+
return { exitCode: ExitCode.SUCCESS };
|
|
591978
|
+
}
|
|
591928
591979
|
try {
|
|
591929
591980
|
await deleteEvent(api2, calendarId, eventId);
|
|
591930
591981
|
if (!quiet) {
|
|
@@ -591948,7 +591999,7 @@ async function handleDelete(opts) {
|
|
|
591948
591999
|
}
|
|
591949
592000
|
}
|
|
591950
592001
|
function createDeleteCommand() {
|
|
591951
|
-
return new Command("delete").description("Delete a calendar event").argument("<event-id>", "Event ID").option("-c, --calendar <id>", "Calendar ID to query");
|
|
592002
|
+
return new Command("delete").description("Delete a calendar event").argument("<event-id>", "Event ID").option("-c, --calendar <id>", "Calendar ID to query").option("--dry-run", "Preview without executing");
|
|
591952
592003
|
}
|
|
591953
592004
|
|
|
591954
592005
|
// src/commands/calendars.ts
|
|
@@ -592389,6 +592440,7 @@ ${url}`);
|
|
|
592389
592440
|
calendarId: resolvedCalendarId,
|
|
592390
592441
|
format: globalOpts.format,
|
|
592391
592442
|
quiet: globalOpts.quiet,
|
|
592443
|
+
dryRun: deleteOpts.dryRun ?? false,
|
|
592392
592444
|
write: (msg) => process.stdout.write(msg + `
|
|
592393
592445
|
`)
|
|
592394
592446
|
});
|