Add Bash completion to Vagrant?

Hi,

I just migrated my main workstation from OpenSUSE Tumbleweed to Rocky Linux 8.6 + KDE.

One of the tools I’m using almost daily is Vagrant in combination with VirtualBox, for teaching and testing purposes. The vagrant package is provided by the third-party Hashicorp repository for RHEL 8.

Under OpenSUSE I had Bash autocompletion for all the vagrant commands. This doesn’t seem to work under Rocky Linux.

Anyone here using Vagrant under Rocky Linux with Bash completion ?

Cheers,

Niki

It looks like this vagrant command should get you there: vagrant autocomplete install --bash … If there are other shells you want to include, you can add them after bash, i.e., --zsh

1 Like

The command doesn’t work, but I investigated what’s going on under the hood. It adds a one-liner to ~/.bashrc to source the completion.sh file under /opt/vagrant, but it gets the path wrong. I did a simple find /opt -name completion.sh and corrected the entry accordingly:

source /opt/vagrant/embedded/gems/2.3.1/gems/vagrant-2.3.1/contrib/bash/completion.sh

Reloaded my session, and now Bash completion works like a charm.

Thanks very much !

You are very welcome!