如何删除/禁用gcloud CLI命令的输出消息

Gab*_*vay 1 command-line-interface stderr command-line-arguments gcloud gcloud-cli

例如:

gcloud compute disks create --size=10GB my-data-disk
Run Code Online (Sandbox Code Playgroud)

会印两件事:

  1. 警告:

    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.
    
    Run Code Online (Sandbox Code Playgroud)

    这可以通过以下方式消除 --verbosity error

  2. 状态:

    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
    
    Run Code Online (Sandbox Code Playgroud)

    这个我不知道如何禁用,然后重定向stderr,当然我不想要因为我仍然要看是否发生错误.

-q论点不会删除它.

Vil*_*las 7

--no-user-output-enabled--user-output-enabled=false标志似乎是你在找什么.

试试这个:

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