MCPcopy
hub / github.com/codeaashu/claude-code / createRipgrepShellIntegration

Function createRipgrepShellIntegration

src/utils/bash/ShellSnapshot.ts:65–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 * @returns Object with type and the shell snippet to use
64 */
65export function createRipgrepShellIntegration(): {
66 type: 'alias' | 'function'
67 snippet: string
68} {
69 const rgCommand = ripgrepCommand()
70
71 // For embedded ripgrep (bun-internal), we need a shell function that sets argv0
72 if (rgCommand.argv0) {
73 return {
74 type: 'function',
75 snippet: createArgv0ShellFunction(
76 'rg',
77 rgCommand.argv0,
78 rgCommand.rgPath,
79 ),
80 }
81 }
82
83 // For regular ripgrep, use a simple alias target
84 const quotedPath = quote([rgCommand.rgPath])
85 const quotedArgs = rgCommand.rgArgs.map(arg => quote([arg]))
86 const aliasTarget =
87 rgCommand.rgArgs.length > 0
88 ? `${quotedPath} ${quotedArgs.join(' ')}`
89 : quotedPath
90
91 return { type: 'alias', snippet: aliasTarget }
92}
93
94/**
95 * VCS directories to exclude from grep searches. Matches the list in

Callers 1

Calls 3

ripgrepCommandFunction · 0.85
createArgv0ShellFunctionFunction · 0.85
quoteFunction · 0.85

Tested by

no test coverage detected