This bash script allows you to autocomplete the BOSH subcommands and their options.
For example, if you're not sure what BOSH subcommands are available,
and this is script is installed and sourced, then simply type bosh
and press Tab twice; you will see a list of BOSH subcommands similar
to the following:
$ bosh
add complete export logs set task
alias create finalize micro snapshots tasks
aliases delete generate properties ssh unset
autocomplete deploy get public start update
aws deployment help recreate status upload
backup deployments init releases stemcells validate
blobs diff inspect rename stop verify
cancel disks instances reset sync version
cleanup download locks restart take vm
cloud-config edit login run target vms
cloudcheck errands logout scp targets
Furthermore, once you choose a specific subcommand, you may still enjoy the
ability to use auto-complete. For example, say you want to know what the
options for bosh create release
are: simply type bosh create release
and
press Tab twice, and you will be presented with the following options
$ bosh create release
--dir --final --name --version
--dry-run --force --timestamp-version --with-tarball
To install:
$ . BoshAutocompleteGetOpt.sh
$ bosh c[tab]
cancel cleanup cloud-config cloudcheck complete create
Auto-completion script is currently auto-generated by patched BOSH CLI, and it can reflect newly-added commands instantly.
e.g.
- Add new command
bosh delete deployment --all
- run:
$ bosh autocomplete > bosh_auto_complete.sh
$ . ./bosh_auto_complete.sh
- type
bosh delete deployment
, and hit tab twice, you will be able to see option--all
If our pull request is
accepted, bosh autocomplete
will become part of the BOSH CLI.