Skip to content

Commit

Permalink
Re-enabled/fixed up resource command package (new commands picked up …
Browse files Browse the repository at this point in the history
…in merge used old-style command decorators)
  • Loading branch information
johanste committed Mar 25, 2016
1 parent 61d8edb commit 23db3f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/azure/cli/commands/resource.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 <resourceGroup>', L('the resource group name'), required=True)
@option('--name -n <name>', L('the resource name'), required=True)
@option('--resource-type -r <resourceType>',
L('the resource type in format: <provider-namespace>/<type>'), required=True)
@option('--api-version -o <apiVersion>', L('the API version of the resource provider'))
@option('--parent <parent>',
L('the name of the parent resource (if needed), in <parent-type>/<parent-name> 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: <provider-namespace>/<type>'),
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 <parent-type>/<parent-name> format'))
def show_resource(args, unexpected): #pylint: disable=unused-argument
rmc = get_mgmt_service_client(ResourceManagementClient, ResourceManagementClientConfiguration)

Expand Down
3 changes: 2 additions & 1 deletion src/azure/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down

0 comments on commit 23db3f7

Please sign in to comment.