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

Adding ParameterType support to Get-CommandWithParameter #18

Open
ShayLevy opened this issue Jul 14, 2013 · 6 comments
Open

Adding ParameterType support to Get-CommandWithParameter #18

ShayLevy opened this issue Jul 14, 2013 · 6 comments

Comments

@ShayLevy
Copy link
Contributor

Is there a reason why Get-CommandWithParameter doesn't support the ParameterType parameter?

With regard to command parameters, currently, Get-CommandWithParameter allows filtering ParameterName only. Having ParameterType will enable another layer of filtering to the current filtering capabilities of the Get-CommandWithParameter function.

@lzybkr
Copy link
Owner

lzybkr commented Jul 14, 2013

No reason other than not having run across a need for it.

Note that unlike Get-Command, the parameter name is required because completers don't currently work purely by the parameter type.


From: Shay Levymailto:[email protected]
Sent: ý7/ý14/ý2013 6:20 AM
To: lzybkr/TabExpansionPlusPlusmailto:[email protected]
Subject: [TabExpansionPlusPlus] Adding ParameterType support to Get-CommandWithParameter (#18)

Is there a reason why Get-CommandWithParameter doesn't support the ParameterType parameter?

With regard to command parameters, currently, Get-CommandWithParameter allows filtering ParameterName only. Having ParameterType will enable another layer of filtering to the current filtering capabilities of the Get-CommandWithParameter function.


Reply to this email directly or view it on GitHubhttps://github.com//issues/18.

@ShayLevy
Copy link
Contributor Author

So, no plans to add it?

@lzybkr
Copy link
Owner

lzybkr commented Jul 14, 2013

Only if there is a definite need.


From: Shay Levymailto:[email protected]
Sent: ý7/ý14/ý2013 7:47 AM
To: lzybkr/TabExpansionPlusPlusmailto:[email protected]
Cc: Jasonmailto:[email protected]
Subject: Re: [TabExpansionPlusPlus] Adding ParameterType support to Get-CommandWithParameter (#18)

So, no plans to add it?


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-20937389.

@ShayLevy
Copy link
Contributor Author

Fair enough.

@ShayLevy
Copy link
Contributor Author

ShayLevy commented Aug 1, 2013

Here's a good example why ParameterType should be added.

Many modules (e.g such as AD,Exchange,SharePoint, etc) makes extensive use of the Identity parameter, to specify the object to operate on.

When writing custom completers for a bunch of commands and for a specific parameter (e.g Identity) we use the Get-CommandWithParameter function along with the parameter name in question.

That covers most cases and allows us to group those commands with a specific parameter name/verb/noun to narrow down the result. But it lacks flexibility/efficiency, especially when the Identity parameter is outside the group of commands grouped by the above.

Let's take the AD commands as an example, there are 9 commands that supports the Identity parameter by the
Microsoft.ActiveDirectory.Management.ADAccount type, but not all commands share the same verb or noun so you can't group all those commands with a single Get-CommandWithParameter command.

Having ParameterType solves it all and can help reduce the amount of completers needed for the job, and imo much safer to use. With a single query we can create completers for a specific type of parameter without having to worry, or rely, on the name of the command.

@favorini
Copy link

+1 for adding -ParameterType for exactly the reason stated above

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

No branches or pull requests

3 participants