gpt4 book ai didi

How to remove/disable the output messages of gcloud CLI commands(如何删除/禁用gCloud CLI命令的输出消息)

转载 作者:bug小助手 更新时间:2023-10-25 13:31:40 27 4
gpt4 key购买 nike



For example:

例如:



gcloud compute disks create --size=10GB my-data-disk


would print 2 things:

会打印两件事:




  1. Warning:



    WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks/persistent-disks#pdperformance.


    This can be eliminated with --verbosity error


  2. Status:



    Created [https://www.googleapis.com/compute/v1/projects/sigma-project-12345/zones/europe-west1-c/disks/my-data-disk].
    NAME ZONE SIZE_GB TYPE STATUS
    my-data-disk europe-west1-c 10 pd-standard READY


    This I don't know how to disable, other then redirecting stderr, which of course I don't want because I still have to see if an error happened.




The -q argument does not remove it.

-q参数不会删除它。


更多回答
优秀答案推荐

The --no-user-output-enabled or --user-output-enabled=false flags seem to be what you are looking for.

--no-user-Output-Enable或--User-Output-Enabled=FALSE标志似乎就是您要寻找的。



Try this:

试试这个:



gcloud compute disks create --size=10GB my-data-disk --no-user-output-enabled

GCloud计算磁盘创建--SIZE=10 GB my-data-disk--无用户输出启用



@Vilas's answer is correct however please note that --no-user-output-enabled broke in some cases around version 141.0. See this issue - https://issuetracker.google.com/issues/36076836

@Vilas的回答是正确的,但是请注意,在某些情况下,在版本141.0左右没有启用用户输出的中断。请参阅本期-https://issuetracker.google.com/issues/36076836



Another option is to disable all the related warnings

另一种选择是禁用所有相关警告


import warnings
warnings.filterwarnings("ignore", "Your application has authenticated using end user credentials")


To permanently disable the survey prompt, run:

要永久禁用调查提示,请运行:


gcloud config set survey/disable_prompts True

FROM : https://cloud.google.com/sdk/gcloud/reference/survey

出发地:https://cloud.google.com/sdk/gcloud/reference/survey


更多回答

thanks Sam, seems to have been fixed and closed in 2019, will give it a try and feedback on this page if I experience any issues for any one else who reads this

谢谢山姆,2019年似乎已经修复并关闭了,如果我遇到任何其他阅读这篇文章的人的问题,我会在这个页面上尝试并反馈

This seems interesting but how to use it?

这看起来很有趣,但如何使用呢?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com