Permalink
Browse files

Added -help switch to psake.ps1 instead of psake-help.ps1 script

Simplificated psake.cmd because of that (also removed some ifs that detected if help should be displayed, because they for example make it impossible to call task with name "help")
  • Loading branch information...
1 parent 391cf6f commit bca24ccda23d4304ef95a81e05b8dcbd648f43ba whut committed Nov 5, 2011
Showing with 16 additions and 20 deletions.
  1. +0 −7 psake-help.ps1
  2. +7 −11 psake.cmd
  3. +9 −2 psake.ps1
View
@@ -1,7 +0,0 @@
-# Helper script to return help text.
-
-remove-module psake -ea 'SilentlyContinue'
-$scriptPath = Split-Path -parent $MyInvocation.MyCommand.path
-import-module (join-path $scriptPath psake.psm1)
-Get-Help Invoke-psake -full
-exit $lastexitcode
View
@@ -1,15 +1,11 @@
@echo off
-SET DIR=%~dp0%
-
-if '%1'=='/?' goto usage
-if '%1'=='-?' goto usage
-if '%1'=='?' goto usage
-if '%1'=='/help' goto usage
-if '%1'=='help' goto usage
-
-powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }"
+if '%1'=='/?' goto help
+if '%1'=='-help' goto help
+if '%1'=='-h' goto help
+powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }"
goto :eof
-:usage
-powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%psake-help.ps1'"
+
+:help
+powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\psake.ps1' -help"
View
@@ -18,14 +18,21 @@ param(
[Parameter(Position=5, Mandatory=0)]
[System.Collections.Hashtable]$properties = @{},
[Parameter(Position=6, Mandatory=0)]
- [string]$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path),
+ [switch]$nologo = $false,
[Parameter(Position=7, Mandatory=0)]
- [switch]$nologo = $false
+ [switch]$help = $false,
+ [Parameter(Position=8, Mandatory=0)]
+ [string]$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)
)
# '[p]sake' is the same as 'psake' but $Error is not polluted
remove-module [p]sake
import-module (join-path $scriptPath psake.psm1)
+if ($help) {
+ Get-Help Invoke-psake -full
+ return
+}
+
if (-not(test-path $buildFile)) {
$absoluteBuildFile = (join-path $scriptPath $buildFile)
if (test-path $absoluteBuildFile) {

0 comments on commit bca24cc

Please sign in to comment.