diff --git a/src/interactive/HISTORY.rst b/src/interactive/HISTORY.rst index ae29fe965ef..b114f5c47b3 100644 --- a/src/interactive/HISTORY.rst +++ b/src/interactive/HISTORY.rst @@ -3,6 +3,10 @@ Release History =============== +upcoming ++++++ +* Add command skipped message in Scenario Execution Mode + 0.5.1 +++++ * Fix bugs to prevent users from exiting the entire az interactive by using Ctrl+C during command execution diff --git a/src/interactive/azext_interactive/azclishell/app.py b/src/interactive/azext_interactive/azclishell/app.py index 12ae42bcd25..72c2d820a94 100644 --- a/src/interactive/azext_interactive/azclishell/app.py +++ b/src/interactive/azext_interactive/azclishell/app.py @@ -569,6 +569,7 @@ def scenario_repl(self, scenario): initial_document=Document(scenario.get('reason') or scenario.get('scenario') or 'Running a E2E Scenario. ') ) quit_scenario = False + all_skipped = True # give notice to users that they can skip a command or quit the scenario print_styled_text([(Style.WARNING, '\nYou can use CTRL C to skip a command of the scenario, ' 'and CTRL D to exit the scenario.')]) @@ -587,6 +588,7 @@ def scenario_repl(self, scenario): document = example_cli.run() except (KeyboardInterrupt, ValueError): # CTRL C + print_styled_text([(Style.WARNING, 'Skipped')]) break if not document: # CTRL D @@ -606,12 +608,20 @@ def scenario_repl(self, scenario): telemetry.set_failure() else: retry = False + all_skipped = False telemetry.set_success() # Update execution result of previous command, fetch recommendation if command failed self.recommender.update_exec_result(self.last_exit_code, telemetry.get_error_info()['result_summary']) telemetry.flush() if quit_scenario: break + if not quit_scenario: + if all_skipped: + print_styled_text([(Style.SUCCESS, '\n(✓)Done: '), + (Style.WARNING, 'All commands Skipped! \n')]) + else: + print_styled_text([(Style.SUCCESS, '\n(✓)Done: '), + (Style.PRIMARY, 'All commands in this scenario have been executed! \n')]) self.completer.enable_scenario_recommender(True) example_cli.exit() del example_cli diff --git a/src/interactive/azext_interactive/azclishell/recommendation.py b/src/interactive/azext_interactive/azclishell/recommendation.py index f5aa5bc2e1f..e0f75d2f5dd 100644 --- a/src/interactive/azext_interactive/azclishell/recommendation.py +++ b/src/interactive/azext_interactive/azclishell/recommendation.py @@ -388,8 +388,6 @@ def gen_command_in_scenario(scenario, file=None): print_styled_text([(Style.ACTION, "Running: ")] + command_sample, file=file) yield nx_cmd, ''.join([part[1] for part in command_sample]) - print_styled_text([(Style.SUCCESS, '\n(✓)Done: '), - (Style.PRIMARY, 'All commands in this scenario have been executed! \n')]) def _get_command_sample(command):