()
| 144 | * Called after `ncode update` so completions stay in sync with the new binary. |
| 145 | */ |
| 146 | export async function regenerateCompletionCache(): Promise<void> { |
| 147 | const shell = detectShell() |
| 148 | if (!shell) { |
| 149 | return |
| 150 | } |
| 151 | |
| 152 | logForDebugging(`update: Regenerating ${shell.name} completion cache`) |
| 153 | |
| 154 | const ncodeBin = process.argv[1] || 'ncode' |
| 155 | const result = await execFileNoThrow(ncodeBin, [ |
| 156 | 'completion', |
| 157 | shell.shellFlag, |
| 158 | '--output', |
| 159 | shell.cacheFile, |
| 160 | ]) |
| 161 | |
| 162 | if (result.code !== 0) { |
| 163 | logForDebugging( |
| 164 | `update: Failed to regenerate ${shell.name} completion cache`, |
| 165 | ) |
| 166 | return |
| 167 | } |
| 168 | |
| 169 | logForDebugging( |
| 170 | `update: Regenerated ${shell.name} completion cache at ${shell.cacheFile}`, |
| 171 | ) |
| 172 | } |
no test coverage detected