Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] Support recommending similar E2E scenarios based on the recent multiple execution commands #5463

Merged
merged 35 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
400c534
Add argument `--scenario` to recommend only scenarios
Oct 9, 2022
51cd068
split displayed result in command and scenario
Oct 13, 2022
07f713f
Merge branch 'main' into next-scenario
Oct 13, 2022
cafbbb5
Merge branch 'main' into next-scenario
Oct 13, 2022
f3f7e39
Add comments and update according to service
Oct 18, 2022
9344205
Update command and scenario top_num as config
Oct 18, 2022
32695dd
Fix some style problems
Oct 18, 2022
bb25b6c
Update style
Oct 18, 2022
8bd57f3
Update style
Oct 19, 2022
50369f3
Update version number
Oct 19, 2022
05f64ba
change executed commands style
Oct 19, 2022
208e6ce
fix command example display style
Oct 19, 2022
3370579
fix executed command style
Oct 19, 2022
33df71a
Update src/next/azext_next/_params.py
ReaNAiveD Oct 19, 2022
e597de7
drop colorma
Oct 19, 2022
ca38921
Apply suggestions from code review
ReaNAiveD Oct 19, 2022
a995698
fix suggestion refactor
Oct 19, 2022
306c002
Update src/next/HISTORY.rst
ReaNAiveD Oct 20, 2022
46b9e81
fix repeated `<` and `>` in command sample
Oct 21, 2022
c8afbf4
Update src/next/azext_next/custom.py
ReaNAiveD Oct 24, 2022
33979ce
Update src/next/azext_next/custom.py
ReaNAiveD Oct 24, 2022
dfac430
remove `exec_idx is None` judgement
Oct 25, 2022
83bafa8
update style
Nov 3, 2022
72af6aa
fix style
Nov 3, 2022
df4e5c4
display command recommendation on top of scenario recommendation
Nov 9, 2022
5a3d7a7
rename multitype judge
Dec 28, 2022
da7e08c
Update src/next/azext_next/custom.py
ReaNAiveD Dec 29, 2022
caf25d3
Fix indent
Dec 30, 2022
0195904
Add feedback when select scenario
Dec 30, 2022
f75d292
Update src/next/azext_next/custom.py
ReaNAiveD Dec 30, 2022
a6b8424
Add comment
Dec 30, 2022
cd052c6
Apply suggestions from code review
ReaNAiveD Dec 30, 2022
288e20e
Update src/next/azext_next/custom.py
ReaNAiveD Dec 30, 2022
d9d79de
Update src/next/azext_next/custom.py
ReaNAiveD Dec 30, 2022
a6a6284
Fix style
Dec 30, 2022
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/next/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.1.3
++++++
* Support recommending similar E2E scenarios based on the recent multiple execution commands
* Add new parameters `--scenario/-s` and `--command/-c` to support specifying recommendation type (command recommendation or scenario recommendation)

0.1.2
++++++
* Fix the bug that the nested command history could not be logged
Expand Down
8 changes: 4 additions & 4 deletions src/next/azext_next/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import threading

from azure.cli.core import AzCommandsLoader

from azext_next._help import helps # pylint: disable=unused-import
import threading


class NextCommandsLoader(AzCommandsLoader):

_instance_lock = threading.Lock()
_has_reload_command_table = False

def __new__(cls, cli_ctx=None):
def __new__(cls, cli_ctx=None): # pylint: disable=unused-argument
if not hasattr(NextCommandsLoader, "_instance"):
with NextCommandsLoader._instance_lock:
if not hasattr(NextCommandsLoader, "_instance"):
Expand All @@ -25,8 +26,7 @@ def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
next_custom = CliCommandType(
operations_tmpl='azext_next.custom#{}')
super(NextCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=next_custom)
super().__init__(cli_ctx=cli_ctx, custom_command_type=next_custom)
zhoxing-ms marked this conversation as resolved.
Show resolved Hide resolved

# Because the help content of other modules needs to be loaded when executing "az next"
# So modify the environment variable AZURE_CORE_USE_COMMAND_INDEX=False, and then reload the command table
Expand Down
15 changes: 9 additions & 6 deletions src/next/azext_next/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@
[1] az config set next.execute_in_prompt=True/False
Turn on/off the step of executing recommended commands in interactive mode. Turn on by default.

[2] az config set next.filter_type=True/False
Turn on/off the step of filtering recommendation type. Turn off by default.
[2] az config set next.recommended_type=all/scenario/command
Set the default recommended type. All is the default.

[3] az config set next.output=json/jsonc/none/table/tsv/yaml/yamlc/status
Set default output format. Status is the default.

[4] az config set next.num_limit={amount_limit}
Set the limit of recommended items. 5 is the default.
[4] az config set next.command_num_limit={command_amount_limit}
Set the limit of recommended command items. 5 is the default.

[5] az config set next.show_arguments=True/False
[5] az config set next.scenario_num_limit={scenario_amount_limit}
Set the limit of recommended scenario items. 5 is the default.

[6] az config set next.show_arguments=True/False
Show/hide the arguments of recommended items. False is the default.

[6] az config set next.print_help=True/False
[7] az config set next.print_help=True/False
Enable/disable whether to print help actively before executing each command. False is the default.

"""
4 changes: 3 additions & 1 deletion src/next/azext_next/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@


def load_arguments(self, _): # pylint: disable=unused-argument
pass
with self.argument_context('next') as c:
c.argument('scenario_only', options_list=['--scenario', '-s'], action='store_true', help='Specify this parameter will only recommend E2E scenarios')
c.argument('command_only', options_list=['--command', '-c'], action='store_true', help='Specify this parameter will only recommend commands')
10 changes: 10 additions & 0 deletions src/next/azext_next/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ class RecommendType(int, Enum):
Solution = 2
Command = 3
Scenario = 4

@staticmethod
def get(name):
if name.lower() == "solution":
return RecommendType.Solution
if name.lower() == "command":
return RecommendType.Command
if name.lower() == "scenario":
return RecommendType.Scenario
return RecommendType.All
Loading