Converge Container Start/Stop/Run/Create into CLI model#14240
Converge Container Start/Stop/Run/Create into CLI model#14240dkbennett wants to merge 17 commits intofeature/wsl-for-appsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request converges the container Start, Stop, Run, and Create commands into the new CLI model, introducing unified argument handling, validation infrastructure, and support for unlimited multi-value arguments. The changes establish patterns for common argument validation and extend the CLI framework to handle more complex command scenarios.
Changes:
- Migrated four container commands (Start, Stop, Create, Run) to the new CLI model with full argument definitions
- Added common argument validation framework with unsigned integer validator for time and signal arguments
- Introduced NO_LIMIT macro (-1) to support unlimited argument values for multi-value arguments like --env and --publish
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/windows/wslc/arguments/Argument.h | Added NO_LIMIT macro and Validate method declaration |
| src/windows/wslc/arguments/ArgumentDefinitions.h | Added 25+ new argument definitions for container commands |
| src/windows/wslc/arguments/ArgumentValidation.h | New header for centralized argument validation functions |
| src/windows/wslc/arguments/ArgumentValidation.cpp | Implements ValidateUInteger and Argument::Validate dispatcher |
| src/windows/wslc/arguments/ArgumentParser.cpp | Updated to handle NO_LIMIT in positional argument anchoring; replaced THROW_HR with WI_ASSERT for internal checks |
| src/windows/wslc/core/Command.cpp | Added validation call integration and NO_LIMIT check in limit enforcement |
| src/windows/wslc/commands/ContainerCommand.h | Added declarations for Create, Run, Start, and Stop command classes |
| src/windows/wslc/commands/ContainerCommand.cpp | Registered new commands as subcommands |
| src/windows/wslc/commands/ContainerCreateCommand.cpp | Implements container create command with argument definitions and task chain |
| src/windows/wslc/commands/ContainerRunCommand.cpp | Implements container run command with detach support and full argument set |
| src/windows/wslc/commands/ContainerStartCommand.cpp | Implements container start command with attach and interactive options |
| src/windows/wslc/commands/ContainerStopCommand.cpp | Implements container stop command with signal/timeout support and --all flag |
| src/windows/wslc/commands/RootCommand.cpp | Registered new commands at root level for direct invocation |
| src/windows/wslc/tasks/ContainerTasks.h | Added task function declarations for new commands |
| src/windows/wslc/tasks/ContainerTasks.cpp | Implements tasks with shared helper for common container options |
| src/windows/wslc/services/PullImageCallback.h | New progress callback for image pull operations with terminal control |
| src/windows/wslc/services/PullImageCallback.cpp | Implements multi-line progress display with ANSI escape codes |
| src/windows/wslc/services/ContainerModel.h | Added includes for unordered_map and string |
| src/windows/wslc/core/ExecutionContextData.h | Added CreateContainerOptions and RunContainerOptions data mappings |
| src/windows/wslc/CMakeLists.txt | Added new source files and (commented) unity build configuration |
| test/windows/wslc/WSLCCLIParserUnitTests.cpp | Refactored to use string::Join utility |
| test/windows/wslc/WSLCCLIExecutionUnitTests.cpp | Added mock handlers for new option types |
| test/windows/wslc/ParserTestCases.h | Added validation test cases and updated NO_LIMIT usage |
| test/windows/wslc/CommandLineTestCases.h | Added test cases for all new commands |
OneBlue
left a comment
There was a problem hiding this comment.
Change looks good. I still think that we avoid parsing non-string command line arguments twice, but that's not worth blocking the change over.
Let's merge this and re-evaluate once we have most the API surface implemented & test coverage
…dd tests for argument validation
Summary of the Pull Request
Porting over Create, Run, Stop, and Start container commands.
Added an argument validator for a common type (unint) for time and signal.
Added support for infinite limit on multi-input arguments.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed