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
5 changes: 5 additions & 0 deletions src/interactive/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============

0.4.2
+++++
* Update to remain compatible with azure-cli 2.0.62.

0.4.1
+++++
* Remove command registration, rely on module to be called.
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/azext_interactive/azclishell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

__version__ = '0.3.24'
VERSION = '0.4.2'
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import os
import yaml # pylint: disable=import-error

from azure.cli.core import MainCommandsLoader

from knack.help import REQUIRED_TAG
from knack.help_files import helps
from knack.log import get_logger
from azure.cli.core import MainCommandsLoader


logger = get_logger(__name__)
Expand Down Expand Up @@ -133,7 +134,7 @@ def load_help_files(data):
""" loads all the extra information from help files """
for command_name, help_yaml in helps.items():

help_entry = yaml.load(help_yaml)
help_entry = yaml.safe_load(help_yaml)
try:
help_type = help_entry['type']
except KeyError:
Expand Down
18 changes: 9 additions & 9 deletions src/interactive/azext_interactive/azclishell/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@
from prompt_toolkit.shortcuts import create_eventloop
# pylint: enable=import-error

from knack.log import get_logger
from knack.util import CLIError

from azure.cli.core.commands.client_factory import ENV_ADDITIONAL_USER_AGENT
from azure.cli.core._config import DEFAULTS_SECTION
from azure.cli.core._profile import _SUBSCRIPTION_NAME, Profile
from azure.cli.core._session import ACCOUNT, CONFIG, SESSION
from azure.cli.core.api import get_config_dir
from azure.cli.core.util import handle_exception

from . import __version__
from knack.log import get_logger
from knack.util import CLIError

from . import VERSION
from .az_completer import AzCompleter
from .az_lexer import get_az_lexer, ExampleLexer, ToolbarLexer
from .configuration import Configuration, SELECT_SYMBOL
Expand Down Expand Up @@ -101,7 +100,7 @@ def __init__(self, cli_ctx, style=None, completer=None,
self.completer = AzCompleter(self, None)
self.lexer = None
self.history = history or FileHistory(os.path.join(self.config.get_config_dir(), self.config.get_history()))
os.environ[ENV_ADDITIONAL_USER_AGENT] = 'AZURECLISHELL/' + __version__
os.environ[ENV_ADDITIONAL_USER_AGENT] = 'AZURECLISHELL/' + VERSION

# OH WHAT FUN TO FIGURE OUT WHAT THESE ARE!
self._cli = None
Expand Down Expand Up @@ -324,10 +323,11 @@ def generate_help_text(self):

def _update_default_info(self):
try:
options = self.cli_ctx.config.config_parser.options(DEFAULTS_SECTION)
defaults_section = self.cli_ctx.config.defaults_section_name
options = self.cli_ctx.config.config_parser.options(defaults_section)
self.config_default = ""
for opt in options:
self.config_default += opt + ": " + self.cli_ctx.config.get(DEFAULTS_SECTION, opt) + " "
self.config_default += opt + ": " + self.cli_ctx.config.get(defaults_section, opt) + " "
except configparser.NoSectionError:
self.config_default = ""

Expand Down Expand Up @@ -477,7 +477,7 @@ def _special_cases(self, cmd, outside):
if not cmd_stripped and cmd:
# add scope if there are only spaces
cmd = self.default_command + " " + cmd
elif cmd_stripped == "quit" or cmd_stripped == "exit":
elif cmd_stripped in ("quit", "exit"):
break_flag = True
elif cmd_stripped == "clear-history":
continue_flag = True
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/azext_interactive/azclishell/argfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_parsed_args(self, comp_words):

try:
active_parsers[0].parse_known_args(comp_words, namespace=parsed_args)
except BaseException:
except BaseException: # pylint: disable=broad-except
pass

self.completing = False
Expand Down
3 changes: 1 addition & 2 deletions src/interactive/azext_interactive/azclishell/key_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,4 @@ def format_response(self, response):
if conversion[response]:
return 'yes'
return 'no'
else:
raise ValueError('Invalid response: input should equate to true or false')
raise ValueError('Invalid response: input should equate to true or false')
2 changes: 1 addition & 1 deletion src/interactive/azext_interactive/azclishell/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,6 @@ def get_descriptions(config, exam_lex, lexer):
get_param(lexer),
])
return get_descript(exam_lex)
elif config.BOOLEAN_STATES[config.config.get('Layout', 'param_description')]:
if config.BOOLEAN_STATES[config.config.get('Layout', 'param_description')]:
return get_param(lexer)
return get_empty()
2 changes: 1 addition & 1 deletion src/interactive/azext_interactive/azclishell/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_window_dim():

if version >= (3, 3):
return _size_36()
elif platform.system() == 'Windows':
if platform.system() == 'Windows':
return _size_windows()
return _size_27()

Expand Down
3 changes: 1 addition & 2 deletions src/interactive/azext_interactive/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.50.dev0",
"azext.maxCliCoreVersion": "2.0.61"
"azext.minCliCoreVersion": "2.0.62"
}
11 changes: 9 additions & 2 deletions src/interactive/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
# --------------------------------------------------------------------------------------------

from codecs import open
import os
import re
from setuptools import setup, find_packages

# Version is also defined in azclishell.__init__.py.
VERSION = "0.4.1"
# Version is defined in azclishell.__init__.py.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for interactive to get at the version defined here in setup.py through code, instead of the other way around? Maybe similarly to how in the core CLI we can get the version of every module.

extension_path = os.path.dirname(os.path.realpath(__file__))
version_file_path = os.path.join(extension_path, 'azext_interactive', 'azclishell', '__init__.py')
with open(version_file_path, 'r') as version_file:
VERSION = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
version_file.read(), re.MULTILINE).group(1)

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
Expand Down