diff --git a/Commands/Add to Calendar.tmCommand b/Commands/Add to Calendar.tmCommand new file mode 100644 index 0000000..744c7d7 --- /dev/null +++ b/Commands/Add to Calendar.tmCommand @@ -0,0 +1,43 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env bash +set -euo pipefail + +TMP="$(mktemp -t tm-ical.XXXXXX).ics" +ICS_PATH="$TMP" +cat - > "$ICS_PATH" + +if ! grep -m1 -q '^BEGIN:VCALENDAR' "$ICS_PATH"; then + echo "Not an iCalendar (.ics) file: missing BEGIN:VCALENDAR" >&2 + exit 1 +fi + +open "$ICS_PATH" + + input + document + inputFormat + text + keyEquivalent + @r + name + Add to Calendar + outputCaret + afterOutput + outputFormat + text + outputLocation + toolTip + scope + source.icalendar + uuid + 63D566BE-B906-41C6-8019-5D43BE5C79ED + version + 2 + +