Skip to content

Commit

Permalink
Added -help switch to psake.ps1 instead of psake-help.ps1 script
Browse files Browse the repository at this point in the history
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
whut committed Nov 5, 2011
1 parent 391cf6f commit bca24cc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
7 changes: 0 additions & 7 deletions psake-help.ps1

This file was deleted.

18 changes: 7 additions & 11 deletions psake.cmd
@@ -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"
11 changes: 9 additions & 2 deletions psake.ps1
Expand Up @@ -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) {
Expand Down

0 comments on commit bca24cc

Please sign in to comment.