MCPcopy Create free account
hub / github.com/codeaashu/claude-code / extractCommandNameAndArgs

Function extractCommandNameAndArgs

src/hooks/useTypeahead.tsx:326–342  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

324 };
325}
326function extractCommandNameAndArgs(value: string): {
327 commandName: string;
328 args: string;
329} | null {
330 if (isCommandInput(value)) {
331 const spaceIndex = value.indexOf(' ');
332 if (spaceIndex === -1) return {
333 commandName: value.slice(1),
334 args: ''
335 };
336 return {
337 commandName: value.slice(1, spaceIndex),
338 args: value.slice(spaceIndex + 1)
339 };
340 }
341 return null;
342}
343function hasCommandWithArguments(isAtEndWithWhitespace: boolean, value: string) {
344 // If value.endsWith(' ') but the user is not at the end, then the user has
345 // potentially gone back to the command in an effort to edit the command name

Callers 1

useTypeaheadFunction · 0.85

Calls 1

isCommandInputFunction · 0.85

Tested by

no test coverage detected