MCPcopy
hub / github.com/ZToolsCenter/ZTools / reloadLocalShortcuts

Function reloadLocalShortcuts

src/renderer/src/stores/commandDataStore.ts:1022–1044  ·  view source on GitHub ↗

* 仅重新加载本地启动项并更新搜索索引,不重新扫描系统应用。

()

Source from the content-addressed store, hash-verified

1020 * 仅重新加载本地启动项并更新搜索索引,不重新扫描系统应用。
1021 */
1022 async function reloadLocalShortcuts(): Promise<void> {
1023 try {
1024 const shortcuts = await window.ztools.localShortcuts.getAll()
1025 localShortcutCommandsCache.value = shortcuts.map((s: any) => ({
1026 name: s.alias || s.name,
1027 path: s.path,
1028 icon: s.icon,
1029 type: 'direct' as const,
1030 subType: 'local-shortcut' as const,
1031 pinyin: s.pinyin || '',
1032 pinyinAbbr: s.pinyinAbbr || '',
1033 cmdType: 'text' as const
1034 }))
1035
1036 rebuildCommandCollections(await loadCommandAliases())
1037
1038 console.log(
1039 `[LocalShortcuts] 本地启动项已更新: ${localShortcutCommandsCache.value.length} 个`
1040 )
1041 } catch (error) {
1042 console.error('[LocalShortcuts] 重载本地启动项失败:', error)
1043 }
1044 }
1045
1046 /**
1047 * 计算匹配分数(用于排序)

Callers 1

initializeDataFunction · 0.85

Calls 2

loadCommandAliasesFunction · 0.85

Tested by

no test coverage detected