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

Merged
merged 2 commits into from
Jul 11, 2025

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

@baronfel baronfel force-pushed the simplify-workload-options branch from 64b5b2a to a1497ff Compare July 11, 2025 01:52
@baronfel baronfel requested a review from a team July 11, 2025 14:16
Copy link
Member

@joeloff joeloff left a comment

Choose a reason for hiding this comment

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

LGTM, minor nit: probably sort the using statements

@baronfel
Copy link
Member Author

@joeloff done - though we really should put that kind of thing into the editorconfig, have dotnet-format do it repo-wide, and then never discuss it again :D

@baronfel baronfel enabled auto-merge (squash) July 11, 2025 16:36
@baronfel baronfel merged commit 460bff1 into dotnet:main Jul 11, 2025
27 checks passed
@baronfel baronfel deleted the simplify-workload-options branch July 12, 2025 01:34
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.

3 participants