Skip to content

push version and info command activation into the Option definitions #49664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Jul 5, 2025

Small cleanup of the WorkloadCommandParser to reduce the amount of custom code we need to write.

@Copilot Copilot AI review requested due to automatic review settings July 5, 2025 13:12
Copy link
Contributor

@Copilot 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 refactors the WorkloadCommandParser by moving the logic that handles --info and --version into the option definitions themselves, eliminating the custom ProcessArgs method.

  • Assigns Action handlers directly on InfoOption and VersionOption
  • Removes bespoke argument-processing in ProcessArgs in favor of built-in handling
  • Introduces ShowWorkloadsInfoAction and ShowWorkloadsVersionOption as nested action classes
Comments suppressed due to low confidence (1)

src/Cli/dotnet/Commands/Workload/WorkloadCommandParser.cs:189

  • [nitpick] The class ShowWorkloadsVersionOption implements an action, so its name ending in 'Option' may be misleading. Consider renaming it to ShowWorkloadsVersionAction for clarity.
    private class ShowWorkloadsVersionOption : SynchronousCommandLineAction

@@ -181,4 +170,34 @@ private static Command ConstructCommand()

return command;
}

private class ShowWorkloadsInfoAction : SynchronousCommandLineAction
Copy link
Preview

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

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

New action classes were introduced (ShowWorkloadsInfoAction and ShowWorkloadsVersionOption) without corresponding tests. Since this is significant behavior change, please add unit tests to cover these handlers.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant