Skip to content

Commit

Permalink
Enable -? help parameter (dotnet#35739)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer authored Mar 3, 2019
1 parent c390ce7 commit b033090
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
@echo off

if "%~1"=="-h" goto help
if "%~1"=="-help" goto help
if "%~1"=="-?" goto help
if "%~1"=="/?" goto help

powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %*
goto end

:help
powershell -ExecutionPolicy ByPass -NoProfile -Command "& { . %~dp0eng\build.ps1; Get-Help }"

:end
exit /b %ERRORLEVEL%
8 changes: 4 additions & 4 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Param(
[switch] $outerloop,
[string] $arch,
[switch] $clean,
[switch][Alias('h')]$help,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)
function Print-Usage() {

function Get-Help() {
Write-Host "Common settings:"
Write-Host " -framework Build framework: netcoreapp, netfx, uap or uapaot (short: -f)"
Write-Host " -configuration <value> Build configuration: Debug or Release (short: -c)"
Expand Down Expand Up @@ -48,8 +48,8 @@ function Print-Usage() {
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -con for configuration, -t for test, etc.)."
}

if ($help -or (($null -ne $properties) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
Print-Usage
# Exit if script has been dot-sourced
if ($MyInvocation.InvocationName -eq ".") {
exit 0
}

Expand Down

0 comments on commit b033090

Please sign in to comment.