Describe the bug
I am using the python code to get all the help information of commands. I find that a global parameter '--subscription' sometimes exists sometimes not. This happens in (all?) commands from extension 'account' and 'webapp'.
To Reproduce
Install azure-cli and extension 'account', run the following python code. Code is easy. It loads all the commands and see if commands 'az account alias create' has parameter '--subscription' and run it 10 times.
from azure.cli.core import MainCommandsLoader, AzCli
from azure.cli.core.commands import AzCliCommandInvoker
from azure.cli.core.parser import AzCliCommandParser
from azure.cli.core.file_util import create_invoker_and_load_cmds_and_args, get_all_help
from azure.cli.core._help import AzCliHelp
for i in range(10):
az_cli = AzCli(cli_name='az',
commands_loader_cls=MainCommandsLoader,
invocation_cls=AzCliCommandInvoker,
parser_cls=AzCliCommandParser,
help_cls=AzCliHelp)
create_invoker_and_load_cmds_and_args(az_cli)
help_files = get_all_help(az_cli)
command_alias_create = next((h for h in help_files if h.command == 'account alias create'), None)
print(f"[Note] 'account alias create' has {len(command_alias_create.parameters)} parameters")
print(f"[Note] 'account alias create' contains '--subscription': {'--subscription' in (p.name for p in command_alias_create.parameters)}")
This is the output in my side. Sometimes command 'az account alias create' has 14 parameters with '--subscription', sometimes it has 13 parameters without '--subscription'.
Expected behavior
The output should always be the same (always has '--subscription' or not).
Related command
az account alias xxx
az webapp xxx
Describe the bug I am using the python code to get all the help information of commands. I find that a global parameter '--subscription' sometimes exists sometimes not. This happens in (all?) commands from extension 'account' and 'webapp'.
To Reproduce Install azure-cli and extension 'account', run the following python code. Code is easy. It loads all the commands and see if commands 'az account alias create' has parameter '--subscription' and run it 10 times.
This is the output in my side. Sometimes command 'az account alias create' has 14 parameters with '--subscription', sometimes it has 13 parameters without '--subscription'.
Expected behavior The output should always be the same (always has '--subscription' or not).
Environment summary
Additional context I am using this information to generate the Docs Page(https://docs.microsoft.com/en-us/cli/azure/account/alias?view=azure-cli-latest) . Currently I have to hard-code the global parameters for all commands because of this issue.