[Nitro CLI] Properly handle invalid --output option value#9576
Merged
tobias-tengler merged 1 commit intomainfrom Apr 17, 2026
Merged
[Nitro CLI] Properly handle invalid --output option value#9576tobias-tengler merged 1 commit intomainfrom
tobias-tengler merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Nitro CLI command execution to properly handle command-line parse errors (specifically invalid --output values) by short-circuiting execution before session/client initialization, and adds/adjusts tests to cover the behavior.
Changes:
- Short-circuit
NitroRootCommand.ExecuteAsync(...)on parse errors and delegate toParseResult.InvokeAsync(...)for correct error reporting/exit codes. - Add a command-level test verifying invalid
--outputvalues return an error and the expected parse error output. - Consolidate/extend environment-variable default option testing and introduce shared test utilities (fixture, interaction mode enum, error factory).
Reviewed changes
Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Nitro/CommandLine/src/CommandLine/Extensions/RootCommandExtensions.cs | Avoids accessing parsed option values when parsing failed; relies on System.CommandLine’s error reporting. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/GlobalOptionsCommandTests.cs | Adds regression test for invalid --output value handling. |
| src/Nitro/CommandLine/test/CommandLine.Tests/GlobalOptionsTests.cs | Moves/extends env var default tests and refactors the test harness to support env provider injection/probe command configuration. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Options/EnvironmentVariableDefaultTests.cs | Removes now-redundant standalone env var default test file. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/NitroCommandFixture.cs | Introduces shared root-command fixture for command tests. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/InteractionMode.cs | Adds interaction mode enum used across command tests. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/MockErrorFactory.cs | Adds centralized mock error setup helpers used by multiple command test bases. |
| src/Nitro/CommandLine/test/CommandLine.Tests/Commands/README.md | Removes the command test migration guide document. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 1, 2026
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.
No description provided.