【问题标题】:How to get shell command completion (autocomplete) for gcloud?如何为 gcloud 获取 shell 命令完成(自动完成)?
【发布时间】:2021-05-27 08:16:06
【问题描述】:

我尝试了 1. 官方 Google installation for Ubuntu 和 2. 单线 sudo snap install google-cloud-sdk --classic,两者都没有给我 tab 的命令自动补全。有没有人找到可以自动完成的安装版本?我在我的最后一台笔记本电脑上安装了它,所以我知道这是可能的

即。用法:gcloud compute instances li(在这里你点击tab)它会自动完成到gcloud compute instances list

谢谢!

【问题讨论】:

    标签: bash ubuntu google-cloud-platform autocomplete ubuntu-20.04


    【解决方案1】:

    我在 2021 年 2 月 24 日晚上 7:00 成功安装了 gcloud 的带有自动完成功能的命令行界面here。 EST(东部标准时间)。我的操作系统是 Ubuntu 20.04

    从上述来源复制的 Shell 命令:

    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
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-06
    • 2021-05-24
    • 2010-12-22
    • 1970-01-01
    • 2012-09-17
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    相关资源
    最近更新 更多