Skip to content
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

Update-List: Pointless invocations without update arguments aren't prevented. #20987

Open
5 tasks done
mklement0 opened this issue Jan 1, 2024 · 0 comments
Open
5 tasks done
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module

Comments

@mklement0
Copy link
Contributor

mklement0 commented Jan 1, 2024

Prerequisites

Steps to reproduce

Update-List only makes senses with:

  • either: -Add and/or -Remove
  • or: -Replace

Not specifying any of these parameters is pointless (effectively a no-op) and should therefore be prevented.

[pscustomobject] @{ foo = [System.Collections.ArrayList] @(1)  } |
  Update-List -Property foo

Expected behavior

An error should be reported.

Note: -Add and -Remove are both non-mandatory, given that neither is conceptually mandatory on its own.
The concept of requiring at least one from a group of related parameters to be bound cannot currently expressed in a declarative manner.

Actual behavior

The input objects are quietly passed through as-is (a no-op).

Error details

No response

Environment data

PowerShell 7.4.0

Visuals

No response

@mklement0 mklement0 added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jan 1, 2024
@iSazonov iSazonov added the WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module
Projects
None yet
Development

No branches or pull requests

2 participants