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 src/interactive/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/interactive/azext_interactive/azclishell/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')])
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down