MCPcopy Create free account
hub / github.com/Noumena-Network/code / createRipgrepShellIntegration

Function createRipgrepShellIntegration

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

Source from the content-addressed store, hash-verified

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