CLI: Update all non-help output to use Reporter#41010
Draft
dkbennett wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes WSLC CLI output by routing most non-help, non-table output through the centralized Reporter, aiming to keep stdout predictable for scripting while using consistent formatting and VT/no-color handling.
Changes:
- Updated multiple CLI tasks/commands to emit output via
context.Reporterinstead ofPrintMessage. - Threaded
Reporter&through session/container service APIs and console attach paths to unify interactive/non-interactive messaging. - Refactored image build/pull progress callbacks to write via the reporter’s Info channel (stderr) and use reporter-derived console width/VT state.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/windows/wslc/tasks/VolumeTasks.cpp | Route volume task output/errors through Reporter. |
| src/windows/wslc/tasks/SessionTasks.cpp | Use Reporter and pass it into SessionService calls. |
| src/windows/wslc/tasks/RegistryTasks.cpp | Use Reporter for registry login/logout success output. |
| src/windows/wslc/tasks/NetworkTasks.cpp | Route network task output/errors through Reporter. |
| src/windows/wslc/tasks/InspectTasks.cpp | Use Reporter for not-found errors and JSON output. |
| src/windows/wslc/tasks/ImageTasks.cpp | Use Reporter and pass it into progress callbacks. |
| src/windows/wslc/tasks/ContainerTasks.cpp | Use Reporter and pass it into ContainerService calls. |
| src/windows/wslc/services/SessionService.h | Add Reporter dependency and update method signatures. |
| src/windows/wslc/services/SessionService.cpp | Emit session messages via Reporter; pass reporter into console attach. |
| src/windows/wslc/services/ImageProgressCallback.h | Require Reporter&; adjust width handling types. |
| src/windows/wslc/services/ImageProgressCallback.cpp | Write progress via reporter Info channel; use reporter console width. |
| src/windows/wslc/services/ContainerService.h | Add Reporter dependency and update method signatures. |
| src/windows/wslc/services/ContainerService.cpp | Emit container messages via Reporter; pass reporter into console attach. |
| src/windows/wslc/services/ConsoleService.h | Add Reporter& to AttachToCurrentConsole API. |
| src/windows/wslc/services/ConsoleService.cpp | Emit detach message via Reporter. |
| src/windows/wslc/services/BuildImageCallback.h | Require Reporter& and gate console behavior off reporter VT state. |
| src/windows/wslc/services/BuildImageCallback.cpp | Route build display output through reporter Info channel; use reporter width. |
| src/windows/wslc/commands/VersionCommand.h | Update PrintVersion to take Reporter&. |
| src/windows/wslc/commands/VersionCommand.cpp | Print version via Reporter instead of PrintMessage. |
| src/windows/wslc/commands/SettingsCommand.cpp | Route settings reset confirmation through Reporter. |
| src/windows/wslc/commands/RootCommand.cpp | Pass reporter into version printing. |
| src/windows/wslc/commands/RegistryCommand.cpp | Route interactive prompts/newlines through Reporter. |
Comment on lines
+71
to
72
| const auto visibleWidth = m_reporter.GetConsoleWidth(Reporter::Level::Info); | ||
|
|
Comment on lines
47
to
52
| void BuildImageCallback::WriteTerminal(std::wstring_view content) const | ||
| { | ||
| DWORD written; | ||
| LOG_IF_WIN32_BOOL_FALSE(WriteConsoleW(m_console, content.data(), static_cast<DWORD>(content.size()), &written, nullptr)); | ||
| // Route the scrolling build display through the Reporter's Info channel (stderr) so it | ||
| // respects the global output state. Each call is one atomic write. | ||
| m_reporter.Write(Reporter::Level::Info, L"{}", content); | ||
| } |
Comment on lines
+36
to
39
| return wil::scope_exit(std::function<void()>([input, mode, &reporter] { | ||
| SetConsoleMode(input, mode); | ||
| std::wcerr << L'\n'; | ||
| reporter.Info(L"\n"); | ||
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This is a standardization of using Reporter across the CLI with two exceptions: The help output and TableOutput, which are a large change and separate. This is alignment across the different commands and callbacks so we consistently use the same output mechanism for all other CLI output.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Verified pull and build callbacks look correct, spot-checked a few other commands.
Relying on E2E tests to ensure functional equivalency.