Skip to content

Migrate System.CommandLine beta4 -> 2.0.7 GA#280

Merged
erikdarlingdata merged 1 commit into
devfrom
chore/system-commandline-ga
Apr 25, 2026
Merged

Migrate System.CommandLine beta4 -> 2.0.7 GA#280
erikdarlingdata merged 1 commit into
devfrom
chore/system-commandline-ga

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

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, no IConsole, 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 or Aliases.Add("-x")
  • IsRequiredRequired
  • AddCommand(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 warnings
  • dotnet test — 71/71 passing
  • planview --help, planview analyze --help, planview credential --help — all render with correct descriptions, defaults, and aliases
  • planview analyze <plan.sqlplan> --warnings-only — emits the expected JSON
  • Smoke: planview analyze --server X --database Y --query "..." against a real server
  • Smoke: planview query-store --server X --database Y --top 5
  • Smoke: planview credential add/list/remove

🤖 Generated with Claude Code

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 erikdarlingdata merged commit b59ebad into dev Apr 25, 2026
2 checks passed
@erikdarlingdata erikdarlingdata deleted the chore/system-commandline-ga branch April 25, 2026 23:40
@erikdarlingdata erikdarlingdata mentioned this pull request Apr 27, 2026
5 tasks
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant