Skip to content

Commit

Permalink
Use knack 0.5.1. (Azure#7780)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott authored and williexu committed Dec 4, 2018
1 parent b8544dc commit 23d55f1
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 177 deletions.
18 changes: 0 additions & 18 deletions azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -498,22 +498,6 @@
<Compile Include="command_modules\azure-cli-hdinsight\azure\cli\command_modules\hdinsight\_params.py" />
<Compile Include="command_modules\azure-cli-hdinsight\azure\cli\command_modules\hdinsight\_validators.py" />
<Compile Include="command_modules\azure-cli-hdinsight\setup.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\app.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\argfinder.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\az_completer.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\az_lexer.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\color_styles.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\command_tree.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\configuration.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\frequency_heuristic.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\gather_commands.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\key_bindings.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\layout.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\progress.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\telemetry.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\threads.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\util.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\_dump_commands.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\test_completion.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\test_feedback.py" />
<Compile Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\test_gather.py" />
Expand Down Expand Up @@ -670,7 +654,6 @@
<Compile Include="command_modules\azure-cli-policyinsights\azure\cli\command_modules\policyinsights\__init__.py" />
<Compile Include="command_modules\azure-cli-policyinsights\setup.py" />
<Compile Include="command_modules\azure-cli-profile\azure\cli\command_modules\profile\tests\latest\test_profile_custom.py" />
<Compile Include="command_modules\azure-cli-profile\azure\cli\command_modules\profile\_completers.py" />
<Compile Include="command_modules\azure-cli-profile\azure\cli\command_modules\profile\_format.py" />
<Compile Include="command_modules\azure-cli-profile\azure\cli\command_modules\profile\_help.py">
<SubType>Code</SubType>
Expand Down Expand Up @@ -1123,7 +1106,6 @@
<Folder Include="command_modules\azure-cli-interactive\azure\cli\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\azclishell\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\" />
<Folder Include="command_modules\azure-cli-interactive\azure\cli\command_modules\interactive\tests\latest\" />
<Folder Include="command_modules\azure-cli-interactive\docs\" />
Expand Down
107 changes: 107 additions & 0 deletions scripts/dependency/requirements.Darwin.external.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
adal==1.1.0
antlr4-python3-runtime==4.7.1
applicationinsights==0.11.6
argcomplete==1.9.4
asn1crypto==0.24.0
azure-batch==5.0.0
azure-common==1.1.15
azure-datalake-store==0.0.31
azure-graphrbac==0.40.0
azure-keyvault==1.1.0
azure-mgmt-advisor==1.0.1
azure-mgmt-authorization==0.50.0
azure-mgmt-batch==5.0.1
azure-mgmt-batchai==2.0.0
azure-mgmt-billing==0.2.0
azure-mgmt-botservice==0.1.0
azure-mgmt-cdn==3.0.0
azure-mgmt-cognitiveservices==3.0.0
azure-mgmt-compute==4.1.0
azure-mgmt-consumption==2.0.0
azure-mgmt-containerinstance==1.1.0
azure-mgmt-containerregistry==2.2.0
azure-mgmt-containerservice==4.2.2
azure-mgmt-cosmosdb==0.4.0
azure-mgmt-datalake-analytics==0.2.0
azure-mgmt-datalake-nspkg==2.0.0
azure-mgmt-datalake-store==0.5.0
azure-mgmt-datamigration==0.1.0
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-iotcentral==0.2.0
azure-mgmt-iothub==0.6.0
azure-mgmt-iothubprovisioningservices==0.2.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-managementgroups==0.1.0
azure-mgmt-maps==0.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-media==1.0.0rc1
azure-mgmt-monitor==0.5.2
azure-mgmt-msi==0.2.0
azure-mgmt-network==2.3.0
azure-mgmt-nspkg==2.0.0
azure-mgmt-policyinsights==0.1.0
azure-mgmt-rdbms==1.3.0
azure-mgmt-recoveryservices==0.1.0
azure-mgmt-recoveryservicesbackup==0.1.1
azure-mgmt-redis==5.0.0
azure-mgmt-relay==0.1.0
azure-mgmt-reservations==0.3.0
azure-mgmt-resource==2.0.0
azure-mgmt-search==2.0.0
azure-mgmt-servicebus==0.5.1
azure-mgmt-servicefabric==0.2.0
azure-mgmt-signalr==0.1.1
azure-mgmt-sql==0.9.1
azure-mgmt-storage==2.0.0rc4
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.40.0
azure-multiapi-storage==0.2.2
azure-nspkg==2.0.0
azure-storage-blob==1.1.0
azure-storage-common==1.1.0
azure-storage-nspkg==3.0.0
bcrypt==3.1.4
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
colorama==0.3.9
cryptography==2.3.1
entrypoints==0.2.3
humanfriendly==4.16.1
idna==2.7
isodate==0.6.0
jmespath==0.9.3
keyring==15.1.0
knack==0.5.1
mock==2.0.0
msrest==0.5.5
msrestazure==0.4.34
oauthlib==2.1.0
paramiko==2.4.1
pbr==4.2.0
portalocker==1.2.1
prompt-toolkit==1.0.15
pyasn1==0.4.4
pycparser==2.18
pydocumentdb==2.3.3
Pygments==2.2.0
PyJWT==1.6.4
PyNaCl==1.2.1
pyOpenSSL==18.0.0
python-dateutil==2.7.3
pytz==2018.5
PyYAML==3.13
requests==2.19.1
requests-oauthlib==1.0.0
scp==0.11.0
six==1.11.0
sshtunnel==0.1.4
tabulate==0.8.2
urllib3==1.23
vsts-cd-manager==1.0.2
wcwidth==0.1.7
websocket-client==0.53.0
Whoosh==2.7.4
xmltodict==0.11.0
109 changes: 109 additions & 0 deletions scripts/dependency/requirements.Linux.external.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
adal==1.1.0
antlr4-python3-runtime==4.7.1
applicationinsights==0.11.6
argcomplete==1.9.4
asn1crypto==0.24.0
azure-batch==5.0.0
azure-common==1.1.15
azure-datalake-store==0.0.31
azure-graphrbac==0.40.0
azure-keyvault==1.1.0
azure-mgmt-advisor==1.0.1
azure-mgmt-authorization==0.50.0
azure-mgmt-batch==5.0.1
azure-mgmt-batchai==2.0.0
azure-mgmt-billing==0.2.0
azure-mgmt-botservice==0.1.0
azure-mgmt-cdn==3.0.0
azure-mgmt-cognitiveservices==3.0.0
azure-mgmt-compute==4.1.0
azure-mgmt-consumption==2.0.0
azure-mgmt-containerinstance==1.1.0
azure-mgmt-containerregistry==2.2.0
azure-mgmt-containerservice==4.2.2
azure-mgmt-cosmosdb==0.4.0
azure-mgmt-datalake-analytics==0.2.0
azure-mgmt-datalake-nspkg==2.0.0
azure-mgmt-datalake-store==0.5.0
azure-mgmt-datamigration==0.1.0
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-iotcentral==0.2.0
azure-mgmt-iothub==0.6.0
azure-mgmt-iothubprovisioningservices==0.2.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-loganalytics==0.2.0
azure-mgmt-managementgroups==0.1.0
azure-mgmt-maps==0.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-media==1.0.0rc1
azure-mgmt-monitor==0.5.2
azure-mgmt-msi==0.2.0
azure-mgmt-network==2.3.0
azure-mgmt-nspkg==2.0.0
azure-mgmt-policyinsights==0.1.0
azure-mgmt-rdbms==1.3.0
azure-mgmt-recoveryservices==0.1.0
azure-mgmt-recoveryservicesbackup==0.1.1
azure-mgmt-redis==5.0.0
azure-mgmt-relay==0.1.0
azure-mgmt-reservations==0.3.0
azure-mgmt-resource==2.0.0
azure-mgmt-search==2.0.0
azure-mgmt-servicebus==0.5.1
azure-mgmt-servicefabric==0.2.0
azure-mgmt-signalr==0.1.1
azure-mgmt-sql==0.9.1
azure-mgmt-storage==2.0.0rc4
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.40.0
azure-multiapi-storage==0.2.2
azure-nspkg==2.0.0
azure-storage-blob==1.1.0
azure-storage-common==1.1.0
azure-storage-nspkg==3.0.0
bcrypt==3.1.4
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
colorama==0.3.9
cryptography==2.3.1
entrypoints==0.2.3
humanfriendly==4.16.1
idna==2.7
isodate==0.6.0
jeepney==0.3.1
jmespath==0.9.3
keyring==15.1.0
knack==0.5.1
mock==2.0.0
msrest==0.5.5
msrestazure==0.4.34
oauthlib==2.1.0
paramiko==2.4.1
pbr==4.2.0
portalocker==1.2.1
prompt-toolkit==1.0.15
pyasn1==0.4.4
pycparser==2.18
pydocumentdb==2.3.3
Pygments==2.2.0
PyJWT==1.6.4
PyNaCl==1.2.1
pyOpenSSL==18.0.0
python-dateutil==2.7.3
pytz==2018.5
PyYAML==3.13
requests==2.19.1
requests-oauthlib==1.0.0
scp==0.11.0
SecretStorage==3.1.0
six==1.11.0
sshtunnel==0.1.4
tabulate==0.8.2
urllib3==1.23
vsts-cd-manager==1.0.2
wcwidth==0.1.7
websocket-client==0.53.0
Whoosh==2.7.4
xmltodict==0.11.0
14 changes: 7 additions & 7 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import six

from knack.arguments import ArgumentsContext
from knack.cli import CLI
from knack.commands import CLICommandsLoader
from knack.completion import ARGCOMPLETE_ENV_NAME
Expand Down Expand Up @@ -242,13 +241,14 @@ def load_arguments(self, command):
command_loaders = self.cmd_to_loader_map.get(command, None)

if command_loaders:
with ArgumentsContext(self, '') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('location', get_location_type(self.cli_ctx))
c.argument('deployment_name', deployment_name_type)
c.argument('cmd', ignore_type)

for loader in command_loaders:
# register global args
with loader.argument_context('') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('location', get_location_type(self.cli_ctx))
c.argument('deployment_name', deployment_name_type)
c.argument('cmd', ignore_type)

loader.command_name = command
self.command_table[command].load_arguments() # this loads the arguments via reflection
loader.load_arguments(command) # this adds entries to the argument registries
Expand Down
59 changes: 3 additions & 56 deletions src/azure-cli-core/azure/cli/core/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
HelpFile as KnackHelpFile,
CommandHelpFile as KnackCommandHelpFile,
CLIHelp,
HelpParameter,
ArgumentGroupRegistry as KnackArgumentGroupRegistry)
from knack.log import get_logger

Expand Down Expand Up @@ -101,21 +100,8 @@ def _should_include_example(self, ex):

# Needs to override base implementation
def _load_from_data(self, data):
if not data:
return

if isinstance(data, str):
self.long_summary = data
return

if 'type' in data:
self.type = data['type']

if 'short-summary' in data:
self.short_summary = data['short-summary']

self.long_summary = data.get('long-summary')

super(CliHelpFile, self)._load_from_data(data)
self.examples = [] # clear examples set by knack
if 'examples' in data:
self.examples = []
for d in data['examples']:
Expand All @@ -126,47 +112,8 @@ def _load_from_data(self, data):
class CliCommandHelpFile(KnackCommandHelpFile, CliHelpFile):

def __init__(self, help_ctx, delimiters, parser):
super(CliCommandHelpFile, self).__init__(help_ctx, delimiters, parser)
import argparse
self.type = 'command'
self.command_source = getattr(parser, 'command_source', None)

self.parameters = []

for action in [a for a in parser._actions if a.help != argparse.SUPPRESS]: # pylint: disable=protected-access
if action.option_strings:
self._add_parameter_help(action)
else:
# use metavar for positional parameters
param_kwargs = {
'name_source': [action.metavar or action.dest],
'deprecate_info': getattr(action, 'deprecate_info', None),
'description': action.help,
'choices': action.choices,
'required': False,
'default': None,
'group_name': 'Positional'
}
self.parameters.append(HelpParameter(**param_kwargs))

help_param = next(p for p in self.parameters if p.name == '--help -h')
help_param.group_name = 'Global Arguments'

def _load_from_data(self, data):
super(CliCommandHelpFile, self)._load_from_data(data)

if isinstance(data, str) or not self.parameters or not data.get('parameters'):
return

loaded_params = []
loaded_param = {}
for param in self.parameters:
loaded_param = next((n for n in data['parameters'] if n['name'] == param.name), None)
if loaded_param:
param.update_from_data(loaded_param)
loaded_params.append(param)

self.parameters = loaded_params
super(CliCommandHelpFile, self).__init__(help_ctx, delimiters, parser)


class ArgumentGroupRegistry(KnackArgumentGroupRegistry): # pylint: disable=too-few-public-methods
Expand Down
Loading

0 comments on commit 23d55f1

Please sign in to comment.