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

Function filterOutCommand

src/main/api/renderer/commandMatchers.ts:52–81  ·  view source on GitHub ↗
(
  list: any[],
  appPath: string,
  featureCode?: string,
  name?: string
)

Source from the content-addressed store, hash-verified

50 * 插件类型优先按 pluginName 匹配;direct/app 匹配 path + name。
51 */
52export function filterOutCommand(
53 list: any[],
54 appPath: string,
55 featureCode?: string,
56 name?: string
57): any[] {
58 return list.filter((item) => {
59 if (item.type === 'plugin' && featureCode !== undefined) {
60 if (item.featureCode !== featureCode) {
61 return true
62 }
63 if (name && item.pluginName) {
64 return item.pluginName !== name
65 }
66 return item.path !== appPath
67 }
68
69 if (isDirectApp(item, item?.type)) {
70 if (name) {
71 return !(item.path === appPath && item.name === name)
72 }
73 return item.path !== appPath
74 }
75
76 if (name) {
77 return !(item.path === appPath && item.name === name)
78 }
79 return item.path !== appPath
80 })
81}
82
83/**
84 * 检查列表中是否已存在匹配项(用于 pinApp)

Callers 3

removeFromHistoryMethod · 0.90
unpinAppMethod · 0.90

Calls 1

isDirectAppFunction · 0.85

Tested by

no test coverage detected