forked from GitHubMirrors/silverbullet-icalendar
Add version command
This commit is contained in:
@@ -56,7 +56,6 @@ select summary, description
|
|||||||
|
|
||||||
## Roadmap
|
## 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
|
- Cache the calendar according to `REFRESH-INTERVAL` or `X-PUBLISHED-TTL`, command for manual update
|
||||||
- More query sources:
|
- More query sources:
|
||||||
- `ical-todo` for `VTODO` components
|
- `ical-todo` for `VTODO` components
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ name: icalendar
|
|||||||
requiredPermissions:
|
requiredPermissions:
|
||||||
- fetch
|
- fetch
|
||||||
functions:
|
functions:
|
||||||
|
showVersion:
|
||||||
|
path: ./icalendar.ts:showVersion
|
||||||
|
command:
|
||||||
|
name: "iCalendar: Version"
|
||||||
|
priority: -2
|
||||||
queryEvents:
|
queryEvents:
|
||||||
path: ./icalendar.ts:queryEvents
|
path: ./icalendar.ts:queryEvents
|
||||||
events:
|
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 { QueryProviderEvent } from "@silverbulletmd/silverbullet/types";
|
||||||
import { applyQuery } from "@silverbulletmd/silverbullet/lib/query";
|
import { applyQuery } from "@silverbulletmd/silverbullet/lib/query";
|
||||||
import { parseIcsCalendar, type VCalendar } from "ts-ics";
|
import { parseIcsCalendar, type VCalendar } from "ts-ics";
|
||||||
|
|
||||||
|
const VERSION = "0.1.0";
|
||||||
|
|
||||||
// Try to match SilverBullet properties where possible.
|
// Try to match SilverBullet properties where possible.
|
||||||
// Timestamps should be strings formatted with `localDateString`
|
// Timestamps should be strings formatted with `localDateString`
|
||||||
interface Event {
|
interface Event {
|
||||||
@@ -119,3 +121,7 @@ export function localDateString(d: Date): string {
|
|||||||
":" + String(d.getSeconds()).padStart(2, "0") +
|
":" + String(d.getSeconds()).padStart(2, "0") +
|
||||||
"." + String(d.getMilliseconds()).padStart(3, "0");
|
"." + String(d.getMilliseconds()).padStart(3, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function showVersion() {
|
||||||
|
await editor.flashNotification(`iCalendar Plug ${VERSION}`);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user