From f77914d4c9045a01b3a91b63c28805f24850c274 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Mon, 23 Dec 2019 17:55:31 -0600 Subject: [PATCH] Fix .cmd scripts help arguments (#1131) --- build.cmd | 15 ++++----------- coreclr.cmd | 7 ++++++- eng/build.ps1 | 6 ++++++ installer.cmd | 7 ++++++- libraries.cmd | 7 ++++++- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/build.cmd b/build.cmd index d8a22ef464f32a..9474e960d718f0 100644 --- a/build.cmd +++ b/build.cmd @@ -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% diff --git a/coreclr.cmd b/coreclr.cmd index 83001a52f8ddbd..4cb16d4cff0402 100644 --- a/coreclr.cmd +++ b/coreclr.cmd @@ -1,2 +1,7 @@ @echo off -"%~dp0build.cmd" -subsetCategory coreclr %* +setlocal + +set _args=-subsetCategory coreclr %* +if "%~1"=="-?" set _args=-help + +"%~dp0build.cmd" %_args% diff --git a/eng/build.ps1 b/eng/build.ps1 index efd3ce99d5aa53..173826b24ccb47 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -1,5 +1,6 @@ [CmdletBinding(PositionalBinding=$false)] Param( + [switch][Alias('h')]$help, [switch][Alias('b')]$build, [switch][Alias('t')]$test, [switch]$buildtests, @@ -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 diff --git a/installer.cmd b/installer.cmd index ad9e5312600a23..dbe665d301677a 100644 --- a/installer.cmd +++ b/installer.cmd @@ -1,2 +1,7 @@ @echo off -"%~dp0build.cmd" -subsetCategory installer %* \ No newline at end of file +setlocal + +set _args=-subsetCategory installer %* +if "%~1"=="-?" set _args=-help + +"%~dp0build.cmd" %_args% diff --git a/libraries.cmd b/libraries.cmd index 6bd85489a2da6b..bfbb0599e60c18 100644 --- a/libraries.cmd +++ b/libraries.cmd @@ -1,2 +1,7 @@ @echo off -"%~dp0build.cmd" -subsetCategory libraries %* \ No newline at end of file +setlocal + +set _args=-subsetCategory libraries %* +if "%~1"=="-?" set _args=-help + +"%~dp0build.cmd" %_args%