MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / hasCommand

Function hasCommand

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

Source from the content-addressed store, hash-verified

85 * 插件类型优先按 pluginName 匹配;direct/app 匹配 path + name。
86 */
87export function hasCommand(
88 list: any[],
89 appPath: string,
90 featureCode?: string,
91 name?: string
92): boolean {
93 return list.some((item) => {
94 if (item.type === 'plugin' && featureCode !== undefined) {
95 if (item.featureCode !== featureCode) {
96 return false
97 }
98 if (name && item.pluginName) {
99 return item.pluginName === name
100 }
101 return item.path === appPath
102 }
103
104 if (isDirectApp(item, item?.type)) {
105 if (name) {
106 return item.path === appPath && item.name === name
107 }
108 return item.path === appPath
109 }
110
111 if (name) {
112 return item.path === appPath && item.name === name
113 }
114 return item.path === appPath
115 })
116}

Callers 2

pinAppMethod · 0.90

Calls 1

isDirectAppFunction · 0.85

Tested by

no test coverage detected