如何获取gcloud的Shell命令完成(自动完成)? [英] How to get shell command completion (autocomplete) for gcloud?

查看:71
本文介绍了如何获取gcloud的Shell命令完成(自动完成)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下两种方法:1.正式的

 #清理:光盘..rm -f google-cloud-sdk-307.0.0-linux-x86_64.tar.gz 

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!

解决方案

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

这篇关于如何获取gcloud的Shell命令完成(自动完成)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆