Permalink
Browse files

Language syntax improvements

* V2 syntax for new PsObject
  • Loading branch information...
1 parent 0fd77cb commit 699736612292c6290f9241d2c8bf66b7fe8491ed @stej stej committed May 24, 2010
Showing with 7 additions and 6 deletions.
  1. +7 −6 psake.psm1
View
@@ -230,10 +230,11 @@ function Write-Documentation
continue
}
$task = $script:context.Peek().tasks.$key
- $content = "" | Select-Object Name, Description, "Depends On"
- $content.Name = $task.Name
- $content.Description = $task.Description
- $content."Depends On" = $task.DependsOn -join ", "
+ $content = new-object PsObject -property @{
+ Name = $task.Name
+ Description = $task.Description
+ "Depends On" = $task.DependsOn -join ", "
+ }
$index = $list.Add($content)
}
@@ -254,10 +255,10 @@ function Write-TaskTimeSummary
{
continue
}
- $list += "" | Select-Object @{Name="Name";Expression={$task.Name}}, @{Name="Duration";Expression={$task.Duration}}
+ $list += New-Object PsObject -property @{Name=$task.Name; Duration = $task.Duration}
}
[Array]::Reverse($list)
- $list += "" | Select-Object @{Name="Name";Expression={"Total:"}}, @{Name="Duration";Expression={$stopwatch.Elapsed}}
+ $list += New-Object PsObject -property @{Name="Total:"; Duration=$stopwatch.Elapsed}
$list | Format-Table -Auto | Out-String -Stream | ? {$_} # using "Out-String -Stream" to filter out the blank line that Format-Table prepends
}

0 comments on commit 6997366

Please sign in to comment.