Vagrant: Add bash completion to vagrant

Created on 1 Jul 2011  ยท  10Comments  ยท  Source: hashicorp/vagrant

It would be nice to add bash completion when entering 'vagrant [tab][tab]'.

Debian example

Most helpful comment

@PHLAK, guys:
it turns out the bash completion script is actually bundled in this repo since 2012:

https://github.com/hashicorp/vagrant/blob/master/contrib/bash/completion.sh

On Ubuntu you can find it at /opt/vagrant/embedded/gems/gems/vagrant-1.9.8/contrib/bash/completion.sh

And that's exactly what the homebrew formula vagrant-completion installs.

All 10 comments

This would be a "cool to have" feature for Vagrant 1.0. Marked as a feature request.

You can find bash completion here, actually: https://github.com/nfedyashev/bash-it/blob/master/plugins/vagrant.plugins.bash

I've asked for permission to include this in the Vagrant source itself but he hasn't given it yet :)

For the benefit of people finding this ticket via google, this code seems to live here now: https://github.com/kura/vagrant-bash-completion

just updating this thread for OS X users:

for bash

# requires homebrew
brew tap homebrew/completions
brew install vagrant-completion
# add following to bashrc
if [ -f `brew --prefix`/etc/bash_completion.d/vagrant ]; then
    source `brew --prefix`/etc/bash_completion.d/vagrant
fi

for zsh

# requires oh-my-zsh
# add vagrant to plugins line in ~/.zshrc, i.e.
plugins=(git osx ruby vagrant)

$ brew install vagrant-completion
==> Downloading https://github.com/kura/vagrant-bash-completion/archive/0.0.4.tar.gz

################################################################## 100,0%

Error: SHA1 mismatch
Expected: 94792b1d50c4c9741f96bf47404ec62dd1ebaaf1
Actual: 4ba3b0d4b0a3af9cfc72a55d32f64a9222699c63
Archive: /Library/Caches/Homebrew/vagrant-completion-0.0.4.tar.gz
(To retry an incomplete download, remove the file above.)

rm /Library/Caches/Homebrew/vagrant-completion-0.0.4.tar.gz

Same error

Seems like the kura project is abandoned but this fork is alive.
https://github.com/brbsix/vagrant-bash-completion

Any reason this hasn't been included with Vagrant yet? It seems like @mitchellh was ready to do so with another package back in 2011. Any chance of revisiting this now?

@PHLAK, guys:
it turns out the bash completion script is actually bundled in this repo since 2012:

https://github.com/hashicorp/vagrant/blob/master/contrib/bash/completion.sh

On Ubuntu you can find it at /opt/vagrant/embedded/gems/gems/vagrant-1.9.8/contrib/bash/completion.sh

And that's exactly what the homebrew formula vagrant-completion installs.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OtezVikentiy picture OtezVikentiy  ยท  3Comments

rhencke picture rhencke  ยท  3Comments

DreadPirateShawn picture DreadPirateShawn  ยท  3Comments

bbaassssiiee picture bbaassssiiee  ยท  3Comments

janw-me picture janw-me  ยท  3Comments