Commit a7eea0b
committed
fix completion of "--"
Use https://cli.urfave.org/v3/examples/completions/shell-completions as a
reference for completions.
The previous version completed "-" -> "--" -> "--help,", but the added comma was
incorrect, as no such flag exists and the tool does not accept it. A similar
issue occurred with "--version", which was shown as "--version,".
The root cause was that completion was explicitly disabled for this case:
$ greet -- --generate-shell-completion
As a result, it printed the default help message:
> NAME:
> greet - A new cli application
>
> USAGE:
> greet [global options] [command [command options]]
>
> COMMANDS:
> add, a add a task to the list
> complete, c complete a task on the list
> template, t options for task templates
> help, h Shows a list of commands or help for one command
>
> GLOBAL OPTIONS:
> --help, -h show help
Bash used "--help," as a flag suggestion, which was incorrect.
In this commit, completion is enabled for the "-- --generate-shell-completion"
case, and a test is added to verify correct behavior.
With this change, both "-" and "--" now complete to "--help", which is correct.1 parent f1ad21b commit a7eea0b
3 files changed
+33
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
271 | 298 | | |
272 | 299 | | |
273 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | | - | |
| 265 | + | |
264 | 266 | | |
265 | 267 | | |
266 | 268 | | |
| |||
489 | 491 | | |
490 | 492 | | |
491 | 493 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | 494 | | |
502 | 495 | | |
503 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1270 | 1270 | | |
1271 | 1271 | | |
1272 | 1272 | | |
1273 | | - | |
| 1273 | + | |
1274 | 1274 | | |
1275 | 1275 | | |
1276 | 1276 | | |
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
1825 | | - | |
| 1825 | + | |
1826 | 1826 | | |
1827 | 1827 | | |
1828 | 1828 | | |
| |||
0 commit comments