* 基于 alias 文本构造一个可搜索的衍生指令。
(command: Command, alias: string, icon?: string)
| 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' |
no outgoing calls
no test coverage detected