const minutes = await arg("Enter the duration (in minutes) to log retroactively")
const title = await arg("Describe the activity you want to log")
let calendar = await env("SCRIPTKIT_LOG_CALENDAR_NAME", {
hint: `Enter the exact name of an existing calendar in your Calendar app`,
})
await applescript(`
tell application "Calendar"
switch view to week view
tell calendar "${calendar}"
set theCurrentDate to current date
make new event at end with properties {summary:"${title}", start date:theCurrentDate - ${minutes} * minutes, end date:theCurrentDate}
end tell
end tell
`)
await notify(`Logged ${minutes} minutes of ${title} to ${calendar}`)