Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<Compile Include="azure-cli-core\azure\cli\core\commands\constants.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="azure-cli-core\azure\cli\core\commands\events.py" />
<Compile Include="azure-cli-core\azure\cli\core\commands\parameters.py" />
<Compile Include="azure-cli-core\azure\cli\core\commands\progress.py" />
<Compile Include="azure-cli-core\azure\cli\core\commands\template_create.py" />
Expand All @@ -43,6 +44,7 @@
<Compile Include="azure-cli-core\azure\cli\core\extensions\experimental.py" />
<Compile Include="azure-cli-core\azure\cli\core\extensions\transform.py" />
<Compile Include="azure-cli-core\azure\cli\core\extensions\__init__.py" />
<Compile Include="azure-cli-core\azure\cli\core\file_util.py" />
<Compile Include="azure-cli-core\azure\cli\core\keys.py" />
<Compile Include="azure-cli-core\azure\cli\core\parser.py" />
<Compile Include="azure-cli-core\azure\cli\core\profiles\_shared.py" />
Expand Down Expand Up @@ -1087,6 +1089,7 @@
<Content Include="command_modules\azure-cli-appservice\azure\cli\command_modules\appservice\tests\latest\server.pfx" />
<Content Include="command_modules\azure-cli-appservice\azure\cli\command_modules\appservice\tests\latest\test.zip" />
<Content Include="command_modules\azure-cli-appservice\HISTORY.rst" />
<Content Include="command_modules\azure-cli-appservice\linter_exclusions.yml" />
<Content Include="command_modules\azure-cli-appservice\README.rst" />
<Content Include="command_modules\azure-cli-appservice\setup.cfg" />
<Content Include="command_modules\azure-cli-backup\HISTORY.rst" />
Expand Down Expand Up @@ -1256,6 +1259,7 @@
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\latest\vmss_create_test_plan.md" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\latest\vm_create_test_plan.md" />
<Content Include="command_modules\azure-cli-vm\HISTORY.rst" />
<Content Include="command_modules\azure-cli-vm\linter_exclusions.yml" />
</ItemGroup>
<ItemGroup>
<Interpreter Include="..\env\">
Expand Down
17 changes: 17 additions & 0 deletions doc/sphinx/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-

from __future__ import print_function

import os
import sphinx

BUILD_DIR = '_build'
FORMAT = 'xml'

argv = ['sphinx-build', '', 'xml', os.getcwd(), BUILD_DIR]
sphinx.make_main(argv)
20 changes: 13 additions & 7 deletions doc/sphinx/azhelpgen/azhelpgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,28 @@


def get_help_files(cli_ctx):
invoker = cli_ctx.invocation_cls(cli_ctx=cli_ctx, commands_loader_cls=cli_ctx.commands_loader_cls, parser_cls=cli_ctx.parser_cls, help_cls=cli_ctx.help_cls)
cli_ctx.invocation = invoker
cmd_table = invoker.commands_loader.load_command_table(None)
cli_ctx.invocation = cli_ctx.invocation_cls(cli_ctx=cli_ctx, commands_loader_cls=cli_ctx.commands_loader_cls, parser_cls=cli_ctx.parser_cls, help_cls=cli_ctx.help_cls)
cli_ctx.invocation.commands_loader.load_command_table([])
cmd_table = cli_ctx.invocation.commands_loader.command_table
for command in cmd_table:
invoker.commands_loader.load_arguments(command)
invoker.parser.load_command_table(invoker.commands_loader.command_table)
cli_ctx.invocation.commands_loader.load_arguments(command)
cli_ctx.invocation.parser.load_command_table(cli_ctx.invocation.commands_loader)

parser_keys = []
parser_values = []
sub_parser_keys = []
sub_parser_values = []
_store_parsers(invoker.parser, parser_keys, parser_values, sub_parser_keys, sub_parser_values)
_store_parsers(cli_ctx.invocation.parser, parser_keys, parser_values, sub_parser_keys, sub_parser_values)
for cmd, parser in zip(parser_keys, parser_values):
if cmd not in sub_parser_keys:
sub_parser_keys.append(cmd)
sub_parser_values.append(parser)

help_ctx = cli_ctx.help_cls(cli_ctx=cli_ctx)
help_files = []
for cmd, parser in zip(sub_parser_keys, sub_parser_values):
try:
help_file = GroupHelpFile(cmd, parser) if _is_group(parser) else CliCommandHelpFile(cmd, parser)
help_file = GroupHelpFile(help_ctx, cmd, parser) if _is_group(parser) else CliCommandHelpFile(help_ctx, cmd, parser)
help_file.load(parser)
help_files.append(help_file)
except Exception as ex:
Expand Down Expand Up @@ -70,6 +72,8 @@ def make_rst(self):
yield ''
yield '{}:summary: {}'.format(INDENT, help_file.short_summary)
yield '{}:description: {}'.format(INDENT, help_file.long_summary)
if help_file.deprecate_info:
yield '{}:deprecated: {}'.format(INDENT, help_file.deprecate_info._get_message(help_file.deprecate_info))
if not is_command:
top_group_name = help_file.command.split()[0] if help_file.command else 'az'
yield '{}:docsource: {}'.format(INDENT, doc_source_map[top_group_name] if top_group_name in doc_source_map else '')
Expand All @@ -89,6 +93,8 @@ def make_rst(self):
yield '{}.. cliarg:: {}'.format(INDENT, arg.name)
yield ''
yield '{}:required: {}'.format(DOUBLEINDENT, arg.required)
if arg.deprecate_info:
yield '{}:deprecated: {}'.format(DOUBLEINDENT, arg.deprecate_info._get_message(arg.deprecate_info))
short_summary = arg.short_summary or ''
possible_values_index = short_summary.find(' Possible values include')
short_summary = short_summary[0:possible_values_index
Expand Down
20 changes: 13 additions & 7 deletions doc/sphinx/cligroup/cligroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ def get_index_text(self, modname, name):

class CliGroupDirective(CliBaseDirective):
doc_field_types = copy.copy(cli_field_types)
doc_field_types.append(
doc_field_types.extend([
Field('docsource', label='Doc Source', has_arg=False,
names=('docsource', 'documentsource'))
)
names=('docsource', 'documentsource')),
Field('deprecated', label='Deprecated', has_arg=False,
names=('deprecated'))
])

class CliCommandDirective(CliBaseDirective):
doc_field_types = copy.copy(cli_field_types)
doc_field_types.append(
doc_field_types.extend([
Field('docsource', label='Doc Source', has_arg=False,
names=('docsource', 'documentsource'))
)
names=('docsource', 'documentsource')),
Field('deprecated', label='Deprecated', has_arg=False,
names=('deprecated'))
])

class CliArgumentDirective(CliBaseDirective):
doc_field_types = copy.copy(cli_field_types)
Expand All @@ -54,7 +58,9 @@ class CliArgumentDirective(CliBaseDirective):
Field('default', label='Default value', has_arg=False,
names=('default')),
Field('source', label='Values from', has_arg=False,
names=('source', 'sources'))
names=('source', 'sources')),
Field('deprecated', label='Deprecated', has_arg=False,
names=('deprecated'))
])

class CliExampleDirective(CliBaseDirective):
Expand Down
47 changes: 47 additions & 0 deletions doc/sphinx/sphinx.pyproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{049fda00-8c5c-43b8-b908-c60adb29813d}</ProjectGuid>
<ProjectHome />
<StartupFile>__main__.py</StartupFile>
<SearchPath />
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<InterpreterId>MSBuild|env|$(MSBuildProjectFullPath)</InterpreterId>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="azhelpgen\azhelpgen.py" />
<Compile Include="azhelpgen\__init__.py" />
<Compile Include="cligroup\cligroup.py" />
<Compile Include="cligroup\__init__.py" />
<Compile Include="conf.py" />
<Compile Include="__main__.py">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="azhelpgen" />
<Folder Include="cligroup" />
</ItemGroup>
<ItemGroup>
<Interpreter Include="..\..\env\">
<Id>env</Id>
<Version>3.6</Version>
<Description>env (Python 3.6 (32-bit))</Description>
<InterpreterPath>Scripts\python.exe</InterpreterPath>
<WindowsInterpreterPath>Scripts\pythonw.exe</WindowsInterpreterPath>
<PathEnvironmentVariable>PYTHONPATH</PathEnvironmentVariable>
<Architecture>X86</Architecture>
</Interpreter>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
</Project>
23 changes: 23 additions & 0 deletions doc/sphinx/sphinx.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "sphinx", "sphinx.pyproj", "{049FDA00-8C5C-43B8-B908-C60ADB29813D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{049FDA00-8C5C-43B8-B908-C60ADB29813D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{049FDA00-8C5C-43B8-B908-C60ADB29813D}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E86FA202-EE47-4610-88A7-EC8B30AD3EF9}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions src/azure-cli-command_modules-nspkg/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.0.2
++++++
* Minor fixes.

2.0.1
+++++
* minor fixes
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-command_modules-nspkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup

VERSION = "2.0.1"
VERSION = "2.0.2"

CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli-core/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.0.41
++++++
* Minor fixes

2.0.40
++++++
* authentication: support authorization code flow for interactive login
Expand Down
22 changes: 18 additions & 4 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
# --------------------------------------------------------------------------------------------
from __future__ import print_function

__version__ = "2.0.40"
__version__ = "2.0.41"

import os
import sys
import timeit

import six

from knack.arguments import ArgumentsContext
from knack.cli import CLI
from knack.commands import CLICommandsLoader
Expand All @@ -18,7 +20,6 @@
from knack.log import get_logger
from knack.util import CLIError

import six

logger = get_logger(__name__)

Expand Down Expand Up @@ -76,6 +77,9 @@ def get_progress_controller(self, det=False):
self.progress_controller.init_progress(progress.get_progress_view(det))
return self.progress_controller

def get_cli_version(self):
return __version__

def show_version(self):
from azure.cli.core.util import get_az_version_string
print(get_az_version_string())
Expand Down Expand Up @@ -126,10 +130,11 @@ def _update_command_table_from_modules(args):
for mod in [m for m in installed_command_modules if m not in BLACKLISTED_MODS]:
try:
start_time = timeit.default_timer()
module_command_table = _load_module_command_loader(self, args, mod)
module_command_table, module_group_table = _load_module_command_loader(self, args, mod)
for cmd in module_command_table.values():
cmd.command_source = mod
self.command_table.update(module_command_table)
self.command_group_table.update(module_group_table)
elapsed_time = timeit.default_timer() - start_time
logger.debug("Loaded module '%s' in %.3f seconds.", mod, elapsed_time)
cumulative_elapsed_time += elapsed_time
Expand Down Expand Up @@ -173,7 +178,8 @@ def _handle_extension_suppressions(extensions):
# from an extension requires this map to be up-to-date.
# self._mod_to_ext_map[ext_mod] = ext_name
start_time = timeit.default_timer()
extension_command_table = _load_extension_command_loader(self, args, ext_mod)
extension_command_table, extension_group_table = \
_load_extension_command_loader(self, args, ext_mod)

for cmd_name, cmd in extension_command_table.items():
cmd.command_source = ExtensionCommandSource(
Expand All @@ -182,6 +188,7 @@ def _handle_extension_suppressions(extensions):
preview=ext.preview)

self.command_table.update(extension_command_table)
self.command_group_table.update(extension_group_table)
elapsed_time = timeit.default_timer() - start_time
logger.debug("Loaded extension '%s' in %.3f seconds.", ext_name, elapsed_time)
except Exception: # pylint: disable=broad-except
Expand Down Expand Up @@ -384,13 +391,19 @@ def get_models(self, *attr_args, **kwargs):
def command_group(self, group_name, command_type=None, **kwargs):
if command_type:
kwargs['command_type'] = command_type
if 'deprecate_info' in kwargs:
kwargs['deprecate_info'].target = group_name
return self._command_group_cls(self, group_name, **kwargs)

def argument_context(self, scope, **kwargs):
return self._argument_context_cls(self, scope, **kwargs)

def _cli_command(self, name, operation=None, handler=None, argument_loader=None, description_loader=None, **kwargs):

from knack.deprecation import Deprecated

kwargs['deprecate_info'] = Deprecated.ensure_new_style_deprecation(self.cli_ctx, kwargs, 'command')

if operation and not isinstance(operation, six.string_types):
raise TypeError("Operation must be a string. Got '{}'".format(operation))
if handler and not callable(handler):
Expand Down Expand Up @@ -439,6 +452,7 @@ def default_description_loader():
min_api=kwargs.get('min_api'),
max_api=kwargs.get('max_api'),
operation_group=kwargs.get('operation_group')):
self._populate_command_group_table_with_subgroups(' '.join(name.split()[:-1]))
self.command_table[name] = self.command_cls(self, name,
handler or default_command_handler,
**kwargs)
Expand Down
Loading