MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / parseArguments

Function parseArguments

source code/utils/argumentSubstitution.ts:26–42  ·  view source on GitHub ↗
(args: string)

Source from the content-addressed store, hash-verified

24 * - "foo 'hello world' baz" => ["foo", "hello world", "baz"]
25 */
26export function parseArguments(args: string): string[] {
27 if (!args || !args.trim()) {
28 return []
29 }
30
31 // Return $KEY to preserve variable syntax literally (don't expand variables)
32 const result = tryParseShellCommand(args, key => `$${key}`)
33 if (!result.success) {
34 // Fall back to simple whitespace split if parsing fails
35 return args.split(/\s+/).filter(Boolean)
36 }
37
38 // Filter to only string tokens (ignore shell operators, etc.)
39 return result.tokens.filter(
40 (token): token is string => typeof token === 'string',
41 )
42}
43
44/**
45 * Parse argument names from the frontmatter 'arguments' field.

Callers 2

substituteArgumentsFunction · 0.85
useTypeaheadFunction · 0.85

Calls 1

tryParseShellCommandFunction · 0.85

Tested by

no test coverage detected