Home Dashboard Directory Help
Search

[PSv4] Dynamic filter methods instead of psv4's method syntax by S.K. _


Status: 

Active


1
0
Sign in
to vote
Type: Suggestion
ID: 798407
Opened: 8/24/2013 7:58:10 AM
Access Restriction: Public
0
Workaround(s)
view

Description

I can't understand benefit of psv4's method syntax.
for example,

(Get-Process).where("name -like p*").ID

is longer than

Get-Process | ? name -like p* | % ID

You might make '?' method in stead of 'where', but '?' is unsuited as a method name, I think.
So method syntax only added a function without benefits. This is harm.


If method syntax are added, It must be more handy than pipeline syntax.
that is, method syntax must have simply syntax that can't do pipeline syntax
In pipeline filter syntax, what we can't omit is 'where'(or '?').
So I suggest 'dynamic filter methods' in order to omit 'where'.

they are defined { property name + operator(like, match, in, ne, lt, gt...etc ) },
like { Name + Like }

for example,

(Get-Process).NameLike("p*").ID
(Get-Process).IDIn(100..10000).Name
(Get-ChildItem).SizeGt(10MB)

this is very handy and TAB COMPLETION FRIENDLY, and this syantax never incarnate in pipeline syntax.

Yeah, you know, the implementation of this function will be very dirty.
But I like this function than psv4's method syntax which have no benefits.

Details
Sign in to post a comment.
Sign in to post a workaround.