From 529c534d4a2d57ed5d7f228052de09c1cf1767f7 Mon Sep 17 00:00:00 2001 From: "Marek S. Lukasiewicz" Date: Sun, 5 Jan 2025 17:57:27 +0100 Subject: [PATCH] Add version command --- README.md | 1 - icalendar.plug.yaml | 5 +++++ icalendar.ts | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b465ea..c3a39d4 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ select summary, description ## Roadmap -- Command for plug version with lower priority (cf. `silverbullet-grep`) - Cache the calendar according to `REFRESH-INTERVAL` or `X-PUBLISHED-TTL`, command for manual update - More query sources: - `ical-todo` for `VTODO` components diff --git a/icalendar.plug.yaml b/icalendar.plug.yaml index 1c463a1..a74e6b6 100644 --- a/icalendar.plug.yaml +++ b/icalendar.plug.yaml @@ -2,6 +2,11 @@ name: icalendar requiredPermissions: - fetch functions: + showVersion: + path: ./icalendar.ts:showVersion + command: + name: "iCalendar: Version" + priority: -2 queryEvents: path: ./icalendar.ts:queryEvents events: diff --git a/icalendar.ts b/icalendar.ts index 354f98d..ba67823 100644 --- a/icalendar.ts +++ b/icalendar.ts @@ -1,8 +1,10 @@ -import { system } from "@silverbulletmd/silverbullet/syscalls"; +import { editor, system } from "@silverbulletmd/silverbullet/syscalls"; import { QueryProviderEvent } from "@silverbulletmd/silverbullet/types"; import { applyQuery } from "@silverbulletmd/silverbullet/lib/query"; import { parseIcsCalendar, type VCalendar } from "ts-ics"; +const VERSION = "0.1.0"; + // Try to match SilverBullet properties where possible. // Timestamps should be strings formatted with `localDateString` interface Event { @@ -119,3 +121,7 @@ export function localDateString(d: Date): string { ":" + String(d.getSeconds()).padStart(2, "0") + "." + String(d.getMilliseconds()).padStart(3, "0"); } + +export async function showVersion() { + await editor.flashNotification(`iCalendar Plug ${VERSION}`); +}