I tried both 1. the official Google installation for Ubuntu, and 2. the one-liner sudo snap install google-cloud-sdk --classic, and neither didn't give me command autocompletion with tab. Has anyone found a version of installation that gives you autocomplete? I had it on my last laptop, so I know it's possible
ie. usage: gcloud compute instances li (here you hit tab) and it autocompletes to gcloud compute instances list
Thanks!
The documentation says to source it in your profile. First, you will need to locate your gcloud installation. For me, it was in /snap. Then, locate the completions file (should be directly under the `` dir). For me, it was:
/snap/google-cloud-cli/current/completion.bash.inc
Last, update your profile. I am on bash so I did
cd
nano .profile
scroll to the end and add: source /snap/google-cloud-cli/current/completion.bash.inc
I successfully installed gcloud's Command Line Interface with autocomplete here on February 24, 2021 at 7:00 P.M. EST (Eastern Standard Time). My operating system is Ubuntu 20.04
Shell commands copied from the aforementioned source:
sudo apt-get update
# You should probably do other commands after this like
# sudo apt-get upgrade, sudo apt-get dist-upgrade,
# but I didn't need them
# can cd wherever here:
cd
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-307.0.0-linux-x86_64.tar.gz
tar –xvzf google-cloud-sdk-307.0.0-linux-x86_64.tar.gz
cd google-cloud-sdk
./install.sh
# Answer a few "y/N" questions, mostly to your preference.
# NOTE: Be sure to answer "Y" to the question "modify profile to update your $PATH and enable shell command completion?" !! (This was the crux of the OP's question)

# Clean up:
cd ..
rm -f google-cloud-sdk-307.0.0-linux-x86_64.tar.gz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With