Azure-cli: Provide a way to call a method and not output anything, maybe something like: "-o none"

Created on 26 Feb 2018  路  5Comments  路  Source: Azure/azure-cli

It would be great to have -o "none" option, that doesn't print anything from the command.

I'm scripting az login and don't want it to print the subs after login.

Output

Most helpful comment

I have just got in this issue creating storage accounts. There is a lot of output that pollute my scripts. Of source I can pipe the output or use the query, but it is so common to have a flag to silence a cli, and it is more readable and portable.
This should be a common option to all az cli commands. I think either

  • there is a --quite flag
  • or the --verbose flag accept a verbosity level.

All 5 comments

Here's a hack I came up with:

az login --query "[?n]|[0]"

You could also pipe your output to null.

@tjprescott - do you know of a good safe cross-plat way to do that?

I have just got in this issue creating storage accounts. There is a lot of output that pollute my scripts. Of source I can pipe the output or use the query, but it is so common to have a flag to silence a cli, and it is more readable and portable.
This should be a common option to all az cli commands. I think either

  • there is a --quite flag
  • or the --verbose flag accept a verbosity level.

We have added option --only-show-errors in #12604 to disable warnings that are written to stderr. It will be included in S167 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhermans picture dhermans  路  3Comments

ahmetb picture ahmetb  路  3Comments

seanknox picture seanknox  路  3Comments

binderjoe picture binderjoe  路  3Comments

Kannaj picture Kannaj  路  3Comments