()
| 64 | * @returns Object with type and the shell snippet to use |
| 65 | */ |
| 66 | export 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 |
no test coverage detected