Filter tasks based on name comes up empty

25 views
Skip to first unread message

Ronnie Holm

unread,
Nov 14, 2011, 3:04:23 AM11/14/11
to psake-users
Suppose I have a psake script with a simple task:

task Clean {
}

Now I can query the script for tasks:

invoke-psake -docs .\Test.ps1

Name Description
---- -----------
Clean

I'd like to query for the Clean task specifically:

invoke-psake -docs .\Master.ps1 | where { $_.Name -eq "Clean" }

But the result comes out empty.

What am I missing here?

Ronnie

Jorge Matos

unread,
Nov 14, 2011, 9:55:42 PM11/14/11
to psake...@googlegroups.com
Ronnie,

The output generated by the -docs option uses format-table to generate the display so what you want to do is not so simple.  One way to achieve what you want is shown below:

invoke-psake -docs .\Master.ps1 | out-string | % {$_.split("`n")} | ? { $_.startswith("Clean") }

HTH


--
You received this message because you are subscribed to the Google Groups "psake-users" group.
To post to this group, send email to psake...@googlegroups.com.
To unsubscribe from this group, send email to psake-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psake-users?hl=en.




--
Jorge Matos
Senior Architect,  Microsoft Certified Solution Developer 
Å (440) 666-3107   matos...@gmail.com  Blog: http://matosjorge2013.wordpress.com  LinkedIn: http://www.linkedin.com/in/jorgematos 


"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."... - Albert Einstein

Reply all
Reply to author
Forward
0 new messages