mirror of
https://github.com/xunleii/silverbullet-icalendar.git
synced 2026-03-15 20:15:23 +00:00
Add version command
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user