trickbz
trickbz

Reputation: 945

Powershell: Hiding second function parameter when first is already defined

I'm trying to implement API of our product using Powershell. E.g., I'd like to create a function Remove-OurProductEntity. This function should have both -ById and -ByFullPath parameters to know which entity to delete. They shouldn't be both mandatory, but only one of them.

If user specified one of them in the command line, the second mustn't appear in autocompletion and Powershell shouldn't ask user to define the second. Moreover, if user specified both, function should ask to define the only one.

Is it possible to be done in Powershell? Or I should handle all the logic inside the function? Powershell has really COOL language, and guess, something similar should be.

Upvotes: 2

Views: 114

Answers (1)

Related Questions