MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / completeCommandArgs

Function completeCommandArgs

packages/app-core/src/components/Editor.tsx:1164–1180  ·  view source on GitHub ↗
(
  input: string,
  command: string,
  options: string[]
)

Source from the content-addressed store, hash-verified

1162let exCycle: ExTabCycle | null = null
1163
1164function completeCommandArgs(
1165 input: string,
1166 command: string,
1167 options: string[]
1168): ExCompletionMatch[] | null {
1169 const match = input.match(/^([A-Za-z0-9_]+)(\s+)([^ ]*)$/)
1170 if (!match) return null
1171 const [, commandName, whitespace, argPrefix] = match
1172 if (commandName.toLowerCase() !== command) return null
1173 const filtered = argPrefix
1174 ? options.filter((option) => option.startsWith(argPrefix.toLowerCase()))
1175 : options
1176 return filtered.map((option) => ({
1177 label: option,
1178 apply: `${commandName}${whitespace}${option}`
1179 }))
1180}
1181
1182function computeExMatches(prefix: string): ExCompletionMatch[] {
1183 const argMatches =

Callers 1

computeExMatchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected