Skip to content

(GH-1393) Rename --version to --required-version for resource commands#1610

Open
michaeltlombardi wants to merge 2 commits into
PowerShell:mainfrom
michaeltlombardi:gh-1393/main/require-version-cli-fields
Open

(GH-1393) Rename --version to --required-version for resource commands#1610
michaeltlombardi wants to merge 2 commits into
PowerShell:mainfrom
michaeltlombardi:gh-1393/main/require-version-cli-fields

Conversation

@michaeltlombardi

Copy link
Copy Markdown
Collaborator

PR Summary

This change:

PR Context

Prior to this change, the dsc resource * subcommands used the --version flag to specify the version requirement for the resource that the command invokes. The option accepts a string which it parses into a ResourceVersionReq instance.

The name of the option was misleading, as it implied that the user should specify a specific version, like 1.2.3, when this would actually parse as the version requirement ^1.2.3, which would match any version >=1.2.3 <2.0.0.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the dsc resource * CLI surface to use --required-version (instead of --version) for specifying a resource version requirement, aligning the flag name with its actual semantics and addressing #1393.

Changes:

  • Renames the resource subcommand argument field from version to required_version, producing a --required-version long flag.
  • Updates the resource subcommand dispatcher match arms to bind required_version as version for downstream calls.
  • Adds --version as a backwards-compatibility alias (currently implemented as a visible alias).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
dsc/src/args.rs Renames the version option to required_version and adds --version aliasing for resource subcommands.
dsc/src/subcommand.rs Updates match patterns for ResourceSubCommand::* to use required_version bindings.

Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/subcommand.rs Outdated
@michaeltlombardi
michaeltlombardi force-pushed the gh-1393/main/require-version-cli-fields branch from cb38a4d to 31789f0 Compare July 7, 2026 18:46
…source commands

Prior to this change, the `dsc resource *` subcommands used the
`--version` flag to specify the version requirement for the resource
that the command invokes. The option accepts a string which it parses
into a `ResourceVersionReq` instance.

The name of the option was misleading, as it implied that the user
should specify a specific version, like `1.2.3`, when this would
actually parse as the version requirement `^1.2.3`, which would match
any version `>=1.2.3 <2.0.0`.

This change:

- Renames the `--version` option to `--required-version` to
better reflect the semantics and minimize confusion.
- Retains the short option `-v` and aliases the long option `--version`
  for backward compatibility.
- Fixes PowerShell#1393
@michaeltlombardi
michaeltlombardi force-pushed the gh-1393/main/require-version-cli-fields branch from 31789f0 to 0320aa6 Compare July 7, 2026 18:48
@michaeltlombardi
michaeltlombardi marked this pull request as ready for review July 7, 2026 18:58
Copilot AI review requested due to automatic review settings July 20, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comment thread dsc/src/args.rs
Comment on lines +231 to +232
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Comment thread dsc/src/args.rs
Comment on lines +244 to +245
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Comment thread dsc/src/args.rs
Comment on lines +259 to +260
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Comment thread dsc/src/args.rs
Comment on lines +272 to +273
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Comment thread dsc/src/args.rs
Comment on lines +287 to +288
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Comment thread dsc/src/args.rs
Comment on lines +296 to +297
#[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
required_version: Option<ResourceVersionReq>,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo PRs

Development

Successfully merging this pull request may close these issues.

Rename version field for dsc resource * commands to required_version

3 participants