Skip to content

Conversation

@geofflamrock
Copy link
Owner

@geofflamrock geofflamrock commented Jun 22, 2025

Converts from Spectre.Console.Cli to System.CommandLine@2.0.0-beta5 now that it has a path to a stable version, paving the way for enabling AOT.

A few changes with this:

  • The way command help is displayed (no more colour or groups) but this is ok for the moment.
  • There was some inconsistency in the way that branches were referenced in some commands, these have been consolidated to be --branch.

Fixes #277

Part of a series of PRs that are adding support for AOT:

@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch 2 times, most recently from 6b146fe to 9049d28 Compare June 22, 2025 06:21
@geofflamrock geofflamrock added the minor Increment the minor version when merged label Jun 22, 2025
@geofflamrock geofflamrock marked this pull request as ready for review June 22, 2025 06:33
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from 9049d28 to b828c3d Compare June 22, 2025 06:39
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from b828c3d to 43b3da7 Compare June 22, 2025 09:16
@geofflamrock geofflamrock requested a review from Copilot June 22, 2025 23:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR converts the command infrastructure from Spectre.Console.Cli to System.CommandLine in order to support AOT and simplify the CLI setup.

  • Removed legacy Spectre.Console.Cli-based settings and registrations.
  • Introduced System.CommandLine-based commands and common options across commands.
  • Updated package references and refactored command handler invocations accordingly.

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.

File Description
src/Stack/Stack.csproj Updated package references to replace Spectre.Console.Cli with System.CommandLine and Spectre.Console.
src/Stack/Program.cs Replaced CommandApp configuration with a StackRootCommand setup using System.CommandLine.
src/Stack/Infrastructure/Commands/* Converted all commands from the old CLI pattern to the new System.CommandLine API.
Other command files Updated command option definitions and handler invocations to use ParseResult from System.CommandLine.
Comments suppressed due to low confidence (1)

src/Stack/Commands/Stack/NewStackCommand.cs:28

  • [nitpick] The option identifier 'StackName' might be confusing since this command creates a new stack; consider renaming it to 'Name' to remain consistent with its usage.
    static readonly Option<string?> StackName = new("--name", "-n")

Comment on lines +37 to +35
private void WriteOutput(bool json, TResponse response)
{
if (settings.Json)
if (json)
Copy link

Copilot AI Jun 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider renaming the 'json' parameter to 'isJsonOutput' or a similar more descriptive name to clearly indicate it is a flag controlling the output format.

Copilot uses AI. Check for mistakes.
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from 43b3da7 to f5639f6 Compare June 23, 2025 09:26
@geofflamrock geofflamrock changed the title Convert to System.CommandLine Convert to System.CommandLine Jun 23, 2025
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from f5639f6 to 3edd2df Compare June 23, 2025 22:17
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from 3edd2df to b5ef711 Compare June 23, 2025 22:31
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from b5ef711 to 269388a Compare June 23, 2025 22:42
@geofflamrock geofflamrock force-pushed the geoffl/system-commandline branch from 269388a to 8e0684f Compare June 23, 2025 23:09
@geofflamrock geofflamrock merged commit 852302e into main Jun 24, 2025
17 checks passed
@geofflamrock geofflamrock deleted the geoffl/system-commandline branch June 24, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Increment the minor version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert to System.CommandLine

1 participant