MCPcopy Index your code
hub / github.com/liuup/claude-code-analysis / parseArgumentNames

Function parseArgumentNames

src/utils/argumentSubstitution.ts:50–68  ·  view source on GitHub ↗
(
  argumentNames: string | string[] | undefined,
)

Source from the content-addressed store, hash-verified

48 * - ["foo", "bar", "baz"] => ["foo", "bar", "baz"]
49 */
50export function parseArgumentNames(
51 argumentNames: string | string[] | undefined,
52): string[] {
53 if (!argumentNames) {
54 return []
55 }
56
57 // Filter out empty strings and numeric-only names (which conflict with $0, $1 shorthand)
58 const isValidName = (name: string): boolean =>
59 typeof name === 'string' && name.trim() !== '' && !/^\d+$/.test(name)
60
61 if (Array.isArray(argumentNames)) {
62 return argumentNames.filter(isValidName)
63 }
64 if (typeof argumentNames === 'string') {
65 return argumentNames.split(/\s+/).filter(isValidName)
66 }
67 return []
68}
69
70/**
71 * Generate argument hint showing remaining unfilled args.

Callers 2

createPluginCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected