Skip to content

Commit

Permalink
Fix .cmd scripts help arguments (dotnet#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
safern authored Dec 23, 2019
1 parent 742a9b8 commit f77914d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
15 changes: 4 additions & 11 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
@echo off
setlocal

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

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

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

:end
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %_args%
exit /b %ERRORLEVEL%
7 changes: 6 additions & 1 deletion coreclr.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
@echo off
"%~dp0build.cmd" -subsetCategory coreclr %*
setlocal

set _args=-subsetCategory coreclr %*
if "%~1"=="-?" set _args=-help

"%~dp0build.cmd" %_args%
6 changes: 6 additions & 0 deletions eng/build.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[CmdletBinding(PositionalBinding=$false)]
Param(
[switch][Alias('h')]$help,
[switch][Alias('b')]$build,
[switch][Alias('t')]$test,
[switch]$buildtests,
Expand Down Expand Up @@ -57,6 +58,11 @@ if ($MyInvocation.InvocationName -eq ".") {
exit 0
}

if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
Get-Help
exit 0
}

$subsetCategory = $subsetCategory.ToLowerInvariant()

# VS Test Explorer support for libraries
Expand Down
7 changes: 6 additions & 1 deletion installer.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
@echo off
"%~dp0build.cmd" -subsetCategory installer %*
setlocal

set _args=-subsetCategory installer %*
if "%~1"=="-?" set _args=-help

"%~dp0build.cmd" %_args%
7 changes: 6 additions & 1 deletion libraries.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
@echo off
"%~dp0build.cmd" -subsetCategory libraries %*
setlocal

set _args=-subsetCategory libraries %*
if "%~1"=="-?" set _args=-help

"%~dp0build.cmd" %_args%

0 comments on commit f77914d

Please sign in to comment.