{TerminalUI} Initial#33321
Conversation
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Thank you for your contribution @emersoj-repo! We will review the pull request and get back to you soon. |
|
@emersoj-repo please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial scaffold for a full-screen Terminal UI experience inside azure-cli-core, implemented with prompt_toolkit, and adds a new --terminal (and -t) entry path to launch it from az.
Changes:
- Added a
TerminalApplication(prompt_toolkit.Application) and a set of basic UI panels (header/command/navigator/output/context). - Hooked a new
--terminal/-targument check intoAzCli.invoke()to launch the Terminal UI instead of executing a normal CLI command. - Added a
start_terminal()method onAzClito run the TUI.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/terminal/app.py | Defines the prompt_toolkit full-screen application, layout, and key bindings. |
| src/azure-cli-core/azure/cli/core/terminal/init.py | Initializes the new terminal package. |
| src/azure-cli-core/azure/cli/core/terminal/panel/init.py | Exposes panel classes for composing the TUI layout. |
| src/azure-cli-core/azure/cli/core/terminal/panel/header.py | Implements header widgets (meta info, shortcuts, recording indicator). |
| src/azure-cli-core/azure/cli/core/terminal/panel/command.py | Implements the command input panel. |
| src/azure-cli-core/azure/cli/core/terminal/panel/navigator.py | Implements the navigation panel placeholder. |
| src/azure-cli-core/azure/cli/core/terminal/panel/output.py | Implements the output panel placeholder. |
| src/azure-cli-core/azure/cli/core/terminal/panel/context.py | Implements the context panel placeholder. |
| src/azure-cli-core/azure/cli/core/init.py | Adds AzCli.invoke() interception for --terminal / -t and start_terminal(). |
Comments suppressed due to low confidence (1)
src/azure-cli-core/azure/cli/core/terminal/app.py:45
toggle_recording()only flipsself.recording, but the layout (includingHeaderPanel(...)) is built once and never refreshed, so Ctrl+R won't change anything on screen. Consider wiringrecordinginto the UI via a dynamic formatted-text control and triggering an invalidate/refresh when toggled.
HeaderPanel('2.15.0', 'xiaojxu@microsoft.com', 'AzureSDKTeam'),
CommandPanel(),
VSplit([NavigatorPanel(), OutputPanel()], height=D()),
ContextPanel()
], padding=0)),
full_screen=True,
mouse_support=True,
key_bindings=kb
)
def toggle_recording(self):
self.recording = not self.recording
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| super(TerminalApplication, self).__init__( | ||
| layout=Layout(HSplit([ | ||
| HeaderPanel('2.15.0', 'xiaojxu@microsoft.com', 'AzureSDKTeam'), | ||
| CommandPanel(), | ||
| VSplit([NavigatorPanel(), OutputPanel()], height=D()), |
|
|
||
| class ShortcutAction(object): | ||
| def __init__(self, shortcuts): | ||
| self.container = Label(text='', width=D()) |
| self.container = Label(text='R', width=1) | ||
|
|
||
| def __pt_container__(self): | ||
| return self.container | ||
|
|
||
|
|
||
| class HeaderPanel(object): | ||
| def __init__(self, cli_version, current_user, subscription, shortcuts=None, recording=False): | ||
| self.container = VSplit([ | ||
| MetaInfo(cli_version, current_user, subscription), | ||
| ShortcutAction(shortcuts), | ||
| RecordingMode(recording) | ||
| ], height=6) | ||
|
|
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| from prompt_toolkit.widgets.base import Label, Box |
| class OutputPanel(object): | ||
| def __init__(self): | ||
| self.container = Frame( | ||
| body=TextArea(text='output'), |
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from prompt_toolkit.widgets.base import Frame, TextArea |
| from prompt_toolkit import Application | ||
| from prompt_toolkit.key_binding import KeyBindings | ||
| from prompt_toolkit.layout.containers import HSplit, VSplit | ||
| from prompt_toolkit.layout.layout import Layout | ||
| from azure.cli.core.terminal.panel import HeaderPanel, CommandPanel, NavigatorPanel, OutputPanel, ContextPanel | ||
| from prompt_toolkit.layout.dimension import D | ||
|
|
||
|
|
||
| kb = KeyBindings() | ||
|
|
||
|
|
||
| @kb.add('c-q') | ||
| def _(event): | ||
| event.app.exit() | ||
|
|
||
|
|
||
| @kb.add('c-r') | ||
| def _(event): | ||
| event.app.toggle_recording() | ||
|
|
||
|
|
||
| class TerminalApplication(Application): | ||
|
|
||
| def __init__(self): |
| if CLI._should_show_version(args): | ||
| self.show_version() | ||
| self.result = CommandResultItem(None) | ||
| elif args and (args[0] == '--terminal' or args[0] == '-t'): | ||
| self.start_terminal() | ||
| else: |
| self.show_version() | ||
| self.result = CommandResultItem(None) | ||
| elif args and (args[0] == '--terminal' or args[0] == '-t'): | ||
| self.start_terminal() |
| elif args and (args[0] == '--terminal' or args[0] == '-t'): | ||
| self.start_terminal() | ||
| else: |
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.