Commit 090daba
authored
feat(setup): install bash completions as fallback for unsupported shells (#282)
## Problem
During `sentry setup`, if the user's shell isn't directly supported
(e.g. xonsh, nushell, tcsh), completions are silently skipped or a \"not
supported\" message is shown. Most systems have bash installed, and many
custom shells can load bash completions as a compatibility layer.
## Solution
When `handleCompletions` encounters an unsupported shell (not
bash/zsh/fish/sh/ash):
- If `bash` is found on `PATH` → install bash completions and inform the
user
- If `bash` is not found → keep the existing \"Not supported\" message
Example output for an xonsh user:
```
Completions: Your shell (unknown) is not directly supported
Installed bash completions as a fallback: ~/.local/share/bash-completion/completions/sentry
```
`sh`/`ash` continue to silently skip completions (no message), as they
are minimal POSIX shells where completions aren't expected.
## Changes
- `src/lib/shell.ts` — `isBashAvailable()` using `Bun.which("bash")`
- `src/commands/cli/setup.ts` — `tryBashCompletionFallback()` helper;
updated `handleCompletions()`
- Tests updated/added for the fallback path, the sh silent-skip, and
`isBashAvailable`1 parent 1e7b397 commit 090daba
File tree
4 files changed
+159
-11
lines changed- src
- commands/cli
- lib
- test
- commands/cli
- lib
4 files changed
+159
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
120 | 149 | | |
121 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
122 | 155 | | |
123 | 156 | | |
124 | 157 | | |
125 | 158 | | |
126 | 159 | | |
127 | | - | |
128 | | - | |
| 160 | + | |
| 161 | + | |
129 | 162 | | |
130 | 163 | | |
131 | 164 | | |
132 | 165 | | |
133 | | - | |
| 166 | + | |
134 | 167 | | |
135 | 168 | | |
136 | 169 | | |
137 | 170 | | |
138 | | - | |
| 171 | + | |
139 | 172 | | |
140 | 173 | | |
141 | 174 | | |
142 | | - | |
143 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
144 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
145 | 197 | | |
146 | 198 | | |
147 | 199 | | |
| |||
284 | 336 | | |
285 | 337 | | |
286 | 338 | | |
287 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
288 | 348 | | |
289 | 349 | | |
290 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
301 | 353 | | |
302 | 354 | | |
303 | 355 | | |
304 | 356 | | |
305 | 357 | | |
306 | | - | |
| 358 | + | |
307 | 359 | | |
308 | 360 | | |
309 | 361 | | |
| |||
314 | 366 | | |
315 | 367 | | |
316 | 368 | | |
317 | | - | |
| 369 | + | |
| 370 | + | |
318 | 371 | | |
319 | 372 | | |
320 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
0 commit comments