lxc autocompletion bash completion when installed via snap

Installed latest lxd via snap

$ sudo snap install lxd
$ snap list lxd
Name Version Rev Developer Notes
lxd 2.21 5866 canonical -

launched ubuntu

$ lxc launch ubuntu:16.04 ubuntu1604

And realized that bash autocompletion doesn’t work when typed lxc exe[TAB] … quick look on-line https://github.com/lxc/lxd/issues/1797 and it seems that /etc/bash_completion.d is is deprecated as per SG post, https://github.com/lxc/lxd/issues/1797#issuecomment-200398443

No fear, you can source snap.lxd.lxc and auto completion will work for lxc again

$ .  /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc

What about next login, will the change still work? Well no, but if you want you can run below and it will work on log in / log out.

$ echo ". /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc" >> ~/.bashrc