MCPcopy Index your code
hub / github.com/codeaashu/claude-code / shouldStopAtArg

Function shouldStopAtArg

src/utils/shell/specPrefix.ts:211–241  ·  view source on GitHub ↗
(
  arg: string,
  args: string[],
  spec: CommandSpec | null,
)

Source from the content-addressed store, hash-verified

209}
210
211async function shouldStopAtArg(
212 arg: string,
213 args: string[],
214 spec: CommandSpec | null,
215): Promise<boolean> {
216 if (arg.startsWith('-')) return true
217
218 const dotIndex = arg.lastIndexOf('.')
219 const hasExtension =
220 dotIndex > 0 &&
221 dotIndex < arg.length - 1 &&
222 !arg.substring(dotIndex + 1).includes(':')
223
224 const hasFile = arg.includes('/') || hasExtension
225 const hasUrl = URL_PROTOCOLS.some(proto => arg.startsWith(proto))
226
227 if (!hasFile && !hasUrl) return false
228
229 // Check if we're after a -m flag for python modules
230 if (spec?.options && args.length > 0 && args[args.length - 1] === '-m') {
231 const option = spec.options.find(opt =>
232 Array.isArray(opt.name) ? opt.name.includes('-m') : opt.name === '-m',
233 )
234 if (option?.args && toArray(option.args).some(arg => arg?.isModule)) {
235 return false // Don't stop at module names
236 }
237 }
238
239 // For actual files/URLs, always stop regardless of context
240 return true
241}
242

Callers 1

buildPrefixFunction · 0.85

Calls 1

toArrayFunction · 0.70

Tested by

no test coverage detected