-
Notifications
You must be signed in to change notification settings - Fork 696
Add CTRL-C guidance message to aspire run command output #10203
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
Add CTRL-C guidance message to aspire run command output #10203
Conversation
Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the aspire run
command to surface a “Press Ctrl+C to stop” message in the console output and highlights the updated markup in all localized resources.
- Changed the default English resource to use
[bold white on red]CTRL+C[/]
markup and flagged translations for review - Updated each XLF translation file’s source markup and set targets to
needs-review-translation
- Inserted a blank line and the guidance message into the Spectre.Console grid in
RunCommand.cs
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/Aspire.Cli/Resources/RunCommandStrings.resx | Changed markup to [bold white on red]CTRL+C[/] and updated comment |
src/Aspire.Cli/Resources/xlf/RunCommandStrings.*.xlf | Updated source to [bold white on red]CTRL+C[/] and flagged targets for review |
src/Aspire.Cli/Commands/RunCommand.cs | Added two rows (spacing + Ctrl+C guidance) to the console grid |
topGrid.AddRow(new Align(new Markup($"[bold green]{logsLocalizedString}[/]:"), HorizontalAlignment.Right), new Text(logFile.FullName)); | ||
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); | ||
topGrid.AddRow(new Text(string.Empty), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guidance message is added after the logs row—per the PR description it should appear before the logs. Move these two AddRow calls so the message displays between the dashboard links and the logs.
topGrid.AddRow(new Align(new Markup($"[bold green]{logsLocalizedString}[/]:"), HorizontalAlignment.Right), new Text(logFile.FullName)); | |
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); | |
topGrid.AddRow(new Text(string.Empty), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); | |
topGrid.AddRow(new Text(string.Empty), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); | |
topGrid.AddRow(new Align(new Markup($"[bold green]{logsLocalizedString}[/]:"), HorizontalAlignment.Right), new Text(logFile.FullName)); | |
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); |
Copilot uses AI. Check for mistakes.
} | ||
topGrid.AddRow(Text.Empty, Text.Empty); | ||
topGrid.AddRow(new Align(new Markup($"[bold green]{logsLocalizedString}[/]:"), HorizontalAlignment.Right), new Text(logFile.FullName)); | ||
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Use the existing Text.Empty constant instead of new Text(string.Empty) for an empty cell to reduce allocations and improve readability.
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); | |
topGrid.AddRow(Text.Empty, Text.Empty); |
Copilot uses AI. Check for mistakes.
topGrid.AddRow(Text.Empty, Text.Empty); | ||
topGrid.AddRow(new Align(new Markup($"[bold green]{logsLocalizedString}[/]:"), HorizontalAlignment.Right), new Text(logFile.FullName)); | ||
topGrid.AddRow(new Text(string.Empty), new Text(string.Empty)); | ||
topGrid.AddRow(new Text(string.Empty), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Wrap the guidance message’s Markup in an Align with HorizontalAlignment.Right (like the logs row) to keep column alignment consistent.
topGrid.AddRow(new Text(string.Empty), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); | |
topGrid.AddRow(new Align(new Text(string.Empty), HorizontalAlignment.Right), new Markup(RunCommandStrings.PressCtrlCToStopAppHost)); |
Copilot uses AI. Check for mistakes.
Why is CTRL+C pink? |
Was just trying to make it stand out a bit. |
apphost should be one word but other than that LGTM |
Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
Head branch was pushed to by a user without write access
Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
Fixed in 0e9ca8b - the CTRL+C message now appears after the endpoints when running in codespaces/remote containers, not before them. |
@copilot revert that last change @maddymontaquila I put the CTRL-C there because if we don't we'll have to continually repaint it (which I was trying to avoid). However upon further reflection I think we should give it a go. I won't get a chance to code it myself for a day or so. The way that I'm going to approach it is that I'm going to have a method that prints out the CTRL-C message, but before I print each endpoint I'm going to have a method that clears the last two lines writes the endpoint, and then prints the CTRL-C message again. The effect should be that the CTRL-C message flows down the page prepending the endpoints to the top if we are in an environment that displays them (codespaces/devcontainers). |
… detection Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
@maddymontaquila code updated. |
Delete the pink background from CTRL+C. It looks kinda tacky |
agree delete the pink but other than that looks good!!! |
/backport to release/9.4 |
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16218551607 |
@mitchdenny backporting to "release/9.4" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Creating an empty commit: Initial plan
Applying: Add CTRL-C guidance message to aspire run command output
Using index info to reconstruct a base tree...
M src/Aspire.Cli/Commands/RunCommand.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Aspire.Cli/Commands/RunCommand.cs
CONFLICT (content): Merge conflict in src/Aspire.Cli/Commands/RunCommand.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Add CTRL-C guidance message to aspire run command output
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
/backport to release/9.4 |
Started backporting to release/9.4: https://github.com/dotnet/aspire/actions/runs/16219031974 |
@mitchdenny backporting to "release/9.4" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Creating an empty commit: Initial plan
Applying: Add CTRL-C guidance message to aspire run command output
Using index info to reconstruct a base tree...
M src/Aspire.Cli/Commands/RunCommand.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Aspire.Cli/Commands/RunCommand.cs
CONFLICT (content): Merge conflict in src/Aspire.Cli/Commands/RunCommand.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Add CTRL-C guidance message to aspire run command output
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
* Initial plan * Add CTRL-C guidance message to aspire run command output Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com> * Update CTRL-C message * Fix CTRL-C message formatting and change "app host" to "apphost" Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com> * Move CTRL+C message to appear after endpoints in codespaces Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com> * Fix CTRL+C message positioning in codespaces by improving environment detection Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com> * Fixes to implementation. * Fix formatting (bye bye pink) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com> Co-authored-by: Mitch Denny <midenn@microsoft.com> Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
…0324) * Initial plan * Add CTRL-C guidance message to aspire run command output * Update CTRL-C message * Fix CTRL-C message formatting and change "app host" to "apphost" * Move CTRL+C message to appear after endpoints in codespaces * Fix CTRL+C message positioning in codespaces by improving environment detection * Fixes to implementation. * Fix formatting (bye bye pink) --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com> Co-authored-by: maddymontaquila <12660687+maddymontaquila@users.noreply.github.com>
Summary
This PR adds a user guidance message to the
aspire run
command output that instructs users how to stop the AppHost. The message "Press Ctrl+C to stop the app host and exit." is displayed in the console grid after the dashboard links and before the logs information.Changes
src/Aspire.Cli/Commands/RunCommand.cs
to add two new rows to the Spectre.Console grid:RunCommandStrings.PressCtrlCToStopAppHost
which contains the properly formatted message with Spectre.Console markupOutput Format
The new output will display:
Implementation Details
The positioning ensures the guidance message appears after all dashboard links but before the logs information, providing clear user instruction on how to terminate the running AppHost.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.