diff --git a/src/azure/cli/commands/resource.py b/src/azure/cli/commands/resource.py index 56da24d21de..2b651b631e9 100644 --- a/src/azure/cli/commands/resource.py +++ b/src/azure/cli/commands/resource.py @@ -1,5 +1,5 @@ -from .._argparse import IncorrectUsageError -from ..commands import CommandTable +from ..parser import IncorrectUsageError +from ..commands import CommandTable, COMMON_PARAMETERS from ._command_creation import get_mgmt_service_client from .._locale import L @@ -30,15 +30,17 @@ def list_groups(args, unexpected): #pylint: disable=unused-argument groups = rmc.resource_groups.list(filter=filter_text) return list(groups) -@command('resource show') -@description(L('Show details of a specific resource in a resource group or subscription')) -@option('--resource-group -g ', L('the resource group name'), required=True) -@option('--name -n ', L('the resource name'), required=True) -@option('--resource-type -r ', - L('the resource type in format: /'), required=True) -@option('--api-version -o ', L('the API version of the resource provider')) -@option('--parent ', - L('the name of the parent resource (if needed), in / format')) +@command_table.command('resource show') +@command_table.description( + L('Show details of a specific resource in a resource group or subscription')) +@command_table.option(**COMMON_PARAMETERS['resource_group_name']) +@command_table.option('--name -n', help=L('the resource name'), required=True) +@command_table.option('--resource-type -r', + help=L('the resource type in format: /'), + required=True) +@command_table.option('--api-version -o', help=L('the API version of the resource provider')) +@command_table.option('--parent', + help=L('the name of the parent resource (if needed), in / format')) def show_resource(args, unexpected): #pylint: disable=unused-argument rmc = get_mgmt_service_client(ResourceManagementClient, ResourceManagementClientConfiguration) diff --git a/src/azure/cli/parser.py b/src/azure/cli/parser.py index dd79e4186b1..ee19c016bf9 100644 --- a/src/azure/cli/parser.py +++ b/src/azure/cli/parser.py @@ -31,7 +31,8 @@ def load_command_table(self, session, command_table): # To work around http://bugs.python.org/issue9253, we artificially add any new # parsers we add to the "choices" section of the subparser. subparser.choices[command_name] = command_name - command_parser = subparser.add_parser(command_name, description=metadata.get('description'), parents=self.parents) + command_parser = subparser.add_parser(command_name, description=metadata.get('description'), + parents=self.parents, conflict_handler='resolve') session.raise_event('AzCliCommandParser.SubparserCreated', {'parser': command_parser, 'metadata': metadata}) for arg in metadata['options']: