MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / buildAliasSearchCommand

Function buildAliasSearchCommand

src/renderer/src/stores/commandDataStore.ts:349–363  ·  view source on GitHub ↗

* 基于 alias 文本构造一个可搜索的衍生指令。

(command: Command, alias: string, icon?: string)

Source from the content-addressed store, hash-verified

347 * 基于 alias 文本构造一个可搜索的衍生指令。
348 */
349 function buildAliasSearchCommand(command: Command, alias: string, icon?: string): Command {
350 return {
351 ...command,
352 name: alias,
353 icon: icon || command.icon,
354 originalName:
355 command.type === 'direct' && command.subType === 'app'
356 ? command.originalName || command.name
357 : command.originalName,
358 pinyin: pinyin(alias, { toneType: 'none', type: 'string' }).replace(/\s+/g, '').toLowerCase(),
359 pinyinAbbr: pinyin(alias, { pattern: 'first', toneType: 'none', type: 'string' })
360 .replace(/\s+/g, '')
361 .toLowerCase()
362 }
363 }
364
365 function getLaunchableAliasEntries(command: Command, aliasesMap: CommandAliasStore): Command[] {
366 const cmdType = command.cmdType || 'text'

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected