Migrate System.CommandLine beta4 -> 2.0.7 GA#280
Merged
Conversation
Mechanical API rename pass — no architectural changes.
- Option<T>(name, description) -> Option<T>(name, ...aliases) { Description = ..., DefaultValueFactory = _ => v, Required = true }
- AddAlias(x) -> ctor params or Aliases.Add(x)
- IsRequired -> Required
- AddCommand(c) -> Subcommands.Add(c)
- SetHandler(async ctx => ...) / SetHandler(binder, opts...) -> SetAction(...)
- ctx.ParseResult.GetValueForOption/Argument(x) -> parseResult.GetValue(x)
- root.InvokeAsync(args) -> root.Parse(args).InvokeAsync()
- Argument<T>(name, description) ctor gone -> single-arg ctor + Description property
Smoke-tested: --help on root, analyze, credential render correctly with
descriptions/defaults/aliases. Functional analyze on a .sqlplan emits the
expected JSON. 71/71 tests passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
erikdarlingdata
added a commit
that referenced
this pull request
Apr 27, 2026
Highlights since v1.8.0: - Minimap for plan navigation (#276) - Colored links by accuracy ratio divergence (#289) - Distinct parallelism subtype icons (#285, #288) - Query Store filter ordering fix (#287) - xunit v2 -> v3 migration (#278) - SqlClient 6 -> 7, ScriptDom 170 -> 180 (#279) - System.CommandLine GA (#280) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Mechanical API rename pass on the CLI. The library was effectively rewritten between beta4 (2022) and GA, but the CLI doesn't use any of the deeper-impact features (no
Parser/CommandLineBuilder, noIConsole, no middleware, no validators, no completions, no hosting integration), so the migration is just find-and-replace.Pattern changes:
new Option<T>(name, description)→new Option<T>(name, ...aliases) { Description = ..., DefaultValueFactory = _ => v, Required = true }AddAlias("-x")→ constructor params orAliases.Add("-x")IsRequired→RequiredAddCommand(c)→Subcommands.Add(c)SetHandler(async ctx => ...)/SetHandler(binder, opts...)→SetAction(parseResult => ...)/SetAction(async (parseResult, ct) => ...)ctx.ParseResult.GetValueForOption/Argument(x)→parseResult.GetValue(x)root.InvokeAsync(args)→root.Parse(args).InvokeAsync()Test plan
dotnet build— 0 errors, 0 source warningsdotnet test— 71/71 passingplanview --help,planview analyze --help,planview credential --help— all render with correct descriptions, defaults, and aliasesplanview analyze <plan.sqlplan> --warnings-only— emits the expected JSONplanview analyze --server X --database Y --query "..."against a real serverplanview query-store --server X --database Y --top 5planview credential add/list/remove🤖 Generated with Claude Code