【问题标题】:Google Cloud Shell gcloud commands output not pretty printed anymoreGoogle Cloud Shell gcloud 命令输出不再打印得很漂亮
【发布时间】:2021-12-01 16:02:39
【问题描述】:

几周前我在使用 GCloud Shell,并从 gcloud 命令中获得了漂亮的打印输出,如下所示:

DISPLAY NAME                            EMAIL                                                 DISABLED
Compute Engine default service account  XXXXXXXXXXXX-compute@developer.gserviceaccount.com    False
sa-xxxxxxxxx                            sa-xxxxxxxxx@my-project.iam.gserviceaccount.com       False

几天后,输出不再漂亮了:

DISPLAY NAME: Compute Engine default service account
EMAIL: XXXXXXXXXXXX-compute@developer.gserviceaccount.com
DISABLED: False

DISPLAY NAME: sa-xxxxxxxxx
EMAIL: sa-xxxxxxxxx@my-project.iam.gserviceaccount.com
DISABLED: False

我检查了嵌入式 gcloud SDK 版本:

$ gcloud -v
Google Cloud SDK 360.0.0
alpha 2021.10.04
app-engine-go 1.9.71
app-engine-java 1.9.91
app-engine-python 1.9.95
app-engine-python-extras 1.9.95
beta 2021.10.04
bigtable
bq 2.0.71
cbt 0.10.1
cloud-build-local 0.5.2
cloud-datastore-emulator 2.1.0
core 2021.10.04
datalab 20190610
gsutil 5.3
kind 0.7.0
kpt 1.0.0-beta.5
local-extract 1.3.1
minikube 1.23.2
pubsub-emulator 0.5.0
skaffold 1.32.0

我还检查了the documentation on output formats,但没有任何帮助。尝试了几个输出,却没有像以前那样漂亮。

我尝试在 Cloud Shell 上安装 SDK 360.0.0,这给了我和以前一样漂亮的输出......

还有其他人有这个问题吗?或者知道如何像以前一样获得漂亮的打印效果(无需手动安装 gcloud SDK)?

编辑:

按照 John Hanley 的要求,这是gcloud config list 的输出:

[accessibility]
screen_reader = True
[component_manager]
disable_update_check = True
[compute]
gce_metadata_read_timeout_sec = 30
[core]
account = nicolas@mydomain.com
disable_usage_reporting = True
project = my-project
[metrics]
environment = devshell

Your active configuration is: [cloudshell-25102]

tput cols 给出的列宽为 267

【问题讨论】:

  • 编辑您的问题并包含有关运行 Cloud Shell 的窗口宽度的详细信息(以列为单位的宽度)。还包括 gcloud config list 的输出。
  • @JohnHanley 按要求完成编辑

标签: google-cloud-platform gcloud google-cloud-sdk google-cloud-shell


【解决方案1】:

感谢@JohnHanley 对gcloud config list 的洞察,我比较了嵌入式gcloud 和下载版本之间的配置,然后阅读了一些文档发现这种行为只是由于现在设置为的可访问性选项造成的默认true

对于遇到此问题的任何人,这里是获取良好 ol' 漂亮打印输出的命令:

gcloud config set accessibility/screen_reader false

如果您希望它在 Cloud Shell 重新启动之间保持不变,请添加 --installation 标志并使用 sudo

【讨论】:

    猜你喜欢
    • 2011-01-27
    • 1970-01-01
    • 2016-01-30
    • 1970-01-01
    • 1970-01-01
    • 2010-09-28
    • 1970-01-01
    • 1970-01-01
    • 2016-08-26
    相关资源
    最近更新 更多