| 1 |
_elan() { |
| 2 |
local i cur prev opts cmds |
| 3 |
COMPREPLY=() |
| 4 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 5 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 6 |
cmd="" |
| 7 |
opts="" |
| 8 |
|
| 9 |
for i in ${COMP_WORDS[@]} |
| 10 |
do |
| 11 |
case "${i}" in |
| 12 |
elan) |
| 13 |
cmd="elan" |
| 14 |
;; |
| 15 |
|
| 16 |
add) |
| 17 |
cmd+="__add" |
| 18 |
;; |
| 19 |
completions) |
| 20 |
cmd+="__completions" |
| 21 |
;; |
| 22 |
default) |
| 23 |
cmd+="__default" |
| 24 |
;; |
| 25 |
help) |
| 26 |
cmd+="__help" |
| 27 |
;; |
| 28 |
install) |
| 29 |
cmd+="__install" |
| 30 |
;; |
| 31 |
link) |
| 32 |
cmd+="__link" |
| 33 |
;; |
| 34 |
list) |
| 35 |
cmd+="__list" |
| 36 |
;; |
| 37 |
override) |
| 38 |
cmd+="__override" |
| 39 |
;; |
| 40 |
remove) |
| 41 |
cmd+="__remove" |
| 42 |
;; |
| 43 |
run) |
| 44 |
cmd+="__run" |
| 45 |
;; |
| 46 |
self) |
| 47 |
cmd+="__self" |
| 48 |
;; |
| 49 |
set) |
| 50 |
cmd+="__set" |
| 51 |
;; |
| 52 |
show) |
| 53 |
cmd+="__show" |
| 54 |
;; |
| 55 |
toolchain) |
| 56 |
cmd+="__toolchain" |
| 57 |
;; |
| 58 |
uninstall) |
| 59 |
cmd+="__uninstall" |
| 60 |
;; |
| 61 |
unset) |
| 62 |
cmd+="__unset" |
| 63 |
;; |
| 64 |
update) |
| 65 |
cmd+="__update" |
| 66 |
;; |
| 67 |
which) |
| 68 |
cmd+="__which" |
| 69 |
;; |
| 70 |
*) |
| 71 |
;; |
| 72 |
esac |
| 73 |
done |
| 74 |
|
| 75 |
case "${cmd}" in |
| 76 |
elan) |
| 77 |
opts=" -v -h -V --verbose --help --version show install uninstall update default toolchain override run which self completions help" |
| 78 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then |
| 79 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 80 |
return 0 |
| 81 |
fi |
| 82 |
case "${prev}" in |
| 83 |
|
| 84 |
*) |
| 85 |
COMPREPLY=() |
| 86 |
;; |
| 87 |
esac |
| 88 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 89 |
return 0 |
| 90 |
;; |
| 91 |
|
| 92 |
elan__completions) |
| 93 |
opts=" -h -V --help --version <shell> " |
| 94 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 95 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 96 |
return 0 |
| 97 |
fi |
| 98 |
case "${prev}" in |
| 99 |
|
| 100 |
*) |
| 101 |
COMPREPLY=() |
| 102 |
;; |
| 103 |
esac |
| 104 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 105 |
return 0 |
| 106 |
;; |
| 107 |
elan__default) |
| 108 |
opts=" -h -V --help --version <toolchain> " |
| 109 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 110 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 111 |
return 0 |
| 112 |
fi |
| 113 |
case "${prev}" in |
| 114 |
|
| 115 |
*) |
| 116 |
COMPREPLY=() |
| 117 |
;; |
| 118 |
esac |
| 119 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 120 |
return 0 |
| 121 |
;; |
| 122 |
elan__help) |
| 123 |
opts=" -h -V --help --version " |
| 124 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 125 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 126 |
return 0 |
| 127 |
fi |
| 128 |
case "${prev}" in |
| 129 |
|
| 130 |
*) |
| 131 |
COMPREPLY=() |
| 132 |
;; |
| 133 |
esac |
| 134 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 135 |
return 0 |
| 136 |
;; |
| 137 |
elan__install) |
| 138 |
opts=" -h -V --help --version <toolchain>... " |
| 139 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 140 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 141 |
return 0 |
| 142 |
fi |
| 143 |
case "${prev}" in |
| 144 |
|
| 145 |
*) |
| 146 |
COMPREPLY=() |
| 147 |
;; |
| 148 |
esac |
| 149 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 150 |
return 0 |
| 151 |
;; |
| 152 |
elan__override) |
| 153 |
opts=" -h -V --help --version list set unset help add remove" |
| 154 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 155 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 156 |
return 0 |
| 157 |
fi |
| 158 |
case "${prev}" in |
| 159 |
|
| 160 |
*) |
| 161 |
COMPREPLY=() |
| 162 |
;; |
| 163 |
esac |
| 164 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 165 |
return 0 |
| 166 |
;; |
| 167 |
elan__override__add) |
| 168 |
opts=" -h -V --help --version <toolchain> " |
| 169 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 170 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 171 |
return 0 |
| 172 |
fi |
| 173 |
case "${prev}" in |
| 174 |
|
| 175 |
*) |
| 176 |
COMPREPLY=() |
| 177 |
;; |
| 178 |
esac |
| 179 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 180 |
return 0 |
| 181 |
;; |
| 182 |
elan__override__help) |
| 183 |
opts=" -h -V --help --version " |
| 184 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 185 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 186 |
return 0 |
| 187 |
fi |
| 188 |
case "${prev}" in |
| 189 |
|
| 190 |
*) |
| 191 |
COMPREPLY=() |
| 192 |
;; |
| 193 |
esac |
| 194 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 195 |
return 0 |
| 196 |
;; |
| 197 |
elan__override__list) |
| 198 |
opts=" -h -V --help --version " |
| 199 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 200 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 201 |
return 0 |
| 202 |
fi |
| 203 |
case "${prev}" in |
| 204 |
|
| 205 |
*) |
| 206 |
COMPREPLY=() |
| 207 |
;; |
| 208 |
esac |
| 209 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 210 |
return 0 |
| 211 |
;; |
| 212 |
elan__override__remove) |
| 213 |
opts=" -h -V --nonexistent --help --version --path " |
| 214 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 215 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 216 |
return 0 |
| 217 |
fi |
| 218 |
case "${prev}" in |
| 219 |
|
| 220 |
--path) |
| 221 |
COMPREPLY=($(compgen -f "${cur}")) |
| 222 |
return 0 |
| 223 |
;; |
| 224 |
*) |
| 225 |
COMPREPLY=() |
| 226 |
;; |
| 227 |
esac |
| 228 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 229 |
return 0 |
| 230 |
;; |
| 231 |
elan__override__set) |
| 232 |
opts=" -h -V --help --version <toolchain> " |
| 233 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 234 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 235 |
return 0 |
| 236 |
fi |
| 237 |
case "${prev}" in |
| 238 |
|
| 239 |
*) |
| 240 |
COMPREPLY=() |
| 241 |
;; |
| 242 |
esac |
| 243 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 244 |
return 0 |
| 245 |
;; |
| 246 |
elan__override__unset) |
| 247 |
opts=" -h -V --nonexistent --help --version --path " |
| 248 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 249 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 250 |
return 0 |
| 251 |
fi |
| 252 |
case "${prev}" in |
| 253 |
|
| 254 |
--path) |
| 255 |
COMPREPLY=($(compgen -f "${cur}")) |
| 256 |
return 0 |
| 257 |
;; |
| 258 |
*) |
| 259 |
COMPREPLY=() |
| 260 |
;; |
| 261 |
esac |
| 262 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 263 |
return 0 |
| 264 |
;; |
| 265 |
elan__run) |
| 266 |
opts=" -h -V --install --help --version <toolchain> <command>... " |
| 267 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 268 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 269 |
return 0 |
| 270 |
fi |
| 271 |
case "${prev}" in |
| 272 |
|
| 273 |
*) |
| 274 |
COMPREPLY=() |
| 275 |
;; |
| 276 |
esac |
| 277 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 278 |
return 0 |
| 279 |
;; |
| 280 |
elan__self) |
| 281 |
opts=" -h -V --help --version update uninstall help" |
| 282 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 283 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 284 |
return 0 |
| 285 |
fi |
| 286 |
case "${prev}" in |
| 287 |
|
| 288 |
*) |
| 289 |
COMPREPLY=() |
| 290 |
;; |
| 291 |
esac |
| 292 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 293 |
return 0 |
| 294 |
;; |
| 295 |
elan__self__help) |
| 296 |
opts=" -h -V --help --version " |
| 297 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 298 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 299 |
return 0 |
| 300 |
fi |
| 301 |
case "${prev}" in |
| 302 |
|
| 303 |
*) |
| 304 |
COMPREPLY=() |
| 305 |
;; |
| 306 |
esac |
| 307 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 308 |
return 0 |
| 309 |
;; |
| 310 |
elan__self__uninstall) |
| 311 |
opts=" -y -h -V --help --version " |
| 312 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 313 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 314 |
return 0 |
| 315 |
fi |
| 316 |
case "${prev}" in |
| 317 |
|
| 318 |
*) |
| 319 |
COMPREPLY=() |
| 320 |
;; |
| 321 |
esac |
| 322 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 323 |
return 0 |
| 324 |
;; |
| 325 |
elan__self__update) |
| 326 |
opts=" -h -V --help --version " |
| 327 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 328 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 329 |
return 0 |
| 330 |
fi |
| 331 |
case "${prev}" in |
| 332 |
|
| 333 |
*) |
| 334 |
COMPREPLY=() |
| 335 |
;; |
| 336 |
esac |
| 337 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 338 |
return 0 |
| 339 |
;; |
| 340 |
elan__show) |
| 341 |
opts=" -h -V --help --version " |
| 342 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 343 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 344 |
return 0 |
| 345 |
fi |
| 346 |
case "${prev}" in |
| 347 |
|
| 348 |
*) |
| 349 |
COMPREPLY=() |
| 350 |
;; |
| 351 |
esac |
| 352 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 353 |
return 0 |
| 354 |
;; |
| 355 |
elan__toolchain) |
| 356 |
opts=" -h -V --help --version list install uninstall link help update add remove" |
| 357 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 358 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 359 |
return 0 |
| 360 |
fi |
| 361 |
case "${prev}" in |
| 362 |
|
| 363 |
*) |
| 364 |
COMPREPLY=() |
| 365 |
;; |
| 366 |
esac |
| 367 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 368 |
return 0 |
| 369 |
;; |
| 370 |
elan__toolchain__add) |
| 371 |
opts=" -h -V --help --version <toolchain>... " |
| 372 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 373 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 374 |
return 0 |
| 375 |
fi |
| 376 |
case "${prev}" in |
| 377 |
|
| 378 |
*) |
| 379 |
COMPREPLY=() |
| 380 |
;; |
| 381 |
esac |
| 382 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 383 |
return 0 |
| 384 |
;; |
| 385 |
elan__toolchain__help) |
| 386 |
opts=" -h -V --help --version " |
| 387 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 388 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 389 |
return 0 |
| 390 |
fi |
| 391 |
case "${prev}" in |
| 392 |
|
| 393 |
*) |
| 394 |
COMPREPLY=() |
| 395 |
;; |
| 396 |
esac |
| 397 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 398 |
return 0 |
| 399 |
;; |
| 400 |
elan__toolchain__install) |
| 401 |
opts=" -h -V --help --version <toolchain>... " |
| 402 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 403 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 404 |
return 0 |
| 405 |
fi |
| 406 |
case "${prev}" in |
| 407 |
|
| 408 |
*) |
| 409 |
COMPREPLY=() |
| 410 |
;; |
| 411 |
esac |
| 412 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 413 |
return 0 |
| 414 |
;; |
| 415 |
elan__toolchain__link) |
| 416 |
opts=" -h -V --help --version <toolchain> <path> " |
| 417 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 418 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 419 |
return 0 |
| 420 |
fi |
| 421 |
case "${prev}" in |
| 422 |
|
| 423 |
*) |
| 424 |
COMPREPLY=() |
| 425 |
;; |
| 426 |
esac |
| 427 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 428 |
return 0 |
| 429 |
;; |
| 430 |
elan__toolchain__list) |
| 431 |
opts=" -h -V --help --version " |
| 432 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 433 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 434 |
return 0 |
| 435 |
fi |
| 436 |
case "${prev}" in |
| 437 |
|
| 438 |
*) |
| 439 |
COMPREPLY=() |
| 440 |
;; |
| 441 |
esac |
| 442 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 443 |
return 0 |
| 444 |
;; |
| 445 |
elan__toolchain__remove) |
| 446 |
opts=" -h -V --help --version <toolchain>... " |
| 447 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 448 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 449 |
return 0 |
| 450 |
fi |
| 451 |
case "${prev}" in |
| 452 |
|
| 453 |
*) |
| 454 |
COMPREPLY=() |
| 455 |
;; |
| 456 |
esac |
| 457 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 458 |
return 0 |
| 459 |
;; |
| 460 |
elan__toolchain__uninstall) |
| 461 |
opts=" -h -V --help --version <toolchain>... " |
| 462 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 463 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 464 |
return 0 |
| 465 |
fi |
| 466 |
case "${prev}" in |
| 467 |
|
| 468 |
*) |
| 469 |
COMPREPLY=() |
| 470 |
;; |
| 471 |
esac |
| 472 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 473 |
return 0 |
| 474 |
;; |
| 475 |
elan__toolchain__update) |
| 476 |
opts=" -h -V --help --version <toolchain>... " |
| 477 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then |
| 478 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 479 |
return 0 |
| 480 |
fi |
| 481 |
case "${prev}" in |
| 482 |
|
| 483 |
*) |
| 484 |
COMPREPLY=() |
| 485 |
;; |
| 486 |
esac |
| 487 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 488 |
return 0 |
| 489 |
;; |
| 490 |
elan__uninstall) |
| 491 |
opts=" -h -V --help --version <toolchain>... " |
| 492 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 493 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 494 |
return 0 |
| 495 |
fi |
| 496 |
case "${prev}" in |
| 497 |
|
| 498 |
*) |
| 499 |
COMPREPLY=() |
| 500 |
;; |
| 501 |
esac |
| 502 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 503 |
return 0 |
| 504 |
;; |
| 505 |
elan__update) |
| 506 |
opts=" -h -V --no-self-update --force --help --version <toolchain>... " |
| 507 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 508 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 509 |
return 0 |
| 510 |
fi |
| 511 |
case "${prev}" in |
| 512 |
|
| 513 |
*) |
| 514 |
COMPREPLY=() |
| 515 |
;; |
| 516 |
esac |
| 517 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 518 |
return 0 |
| 519 |
;; |
| 520 |
elan__which) |
| 521 |
opts=" -h -V --help --version <command> " |
| 522 |
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then |
| 523 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 524 |
return 0 |
| 525 |
fi |
| 526 |
case "${prev}" in |
| 527 |
|
| 528 |
*) |
| 529 |
COMPREPLY=() |
| 530 |
;; |
| 531 |
esac |
| 532 |
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) |
| 533 |
return 0 |
| 534 |
;; |
| 535 |
esac |
| 536 |
} |
| 537 |
|
| 538 |
complete -F _elan -o bashdefault -o default elan |