Skip to content

Commit f77914d

Browse files
authored
Fix .cmd scripts help arguments (dotnet#1131)
1 parent 742a9b8 commit f77914d

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

build.cmd

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
@echo off
2+
setlocal
23

3-
if "%~1"=="-h" goto help
4-
if "%~1"=="-help" goto help
5-
if "%~1"=="-?" goto help
6-
if "%~1"=="/?" goto help
4+
set _args=%*
5+
if "%~1"=="-?" set _args=-help
76

8-
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %*
9-
goto end
10-
11-
:help
12-
powershell -ExecutionPolicy ByPass -NoProfile -Command "& { . '%~dp0eng\build.ps1'; Get-Help }"
13-
14-
:end
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %_args%
158
exit /b %ERRORLEVEL%

coreclr.cmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
@echo off
2-
"%~dp0build.cmd" -subsetCategory coreclr %*
2+
setlocal
3+
4+
set _args=-subsetCategory coreclr %*
5+
if "%~1"=="-?" set _args=-help
6+
7+
"%~dp0build.cmd" %_args%

eng/build.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[CmdletBinding(PositionalBinding=$false)]
22
Param(
3+
[switch][Alias('h')]$help,
34
[switch][Alias('b')]$build,
45
[switch][Alias('t')]$test,
56
[switch]$buildtests,
@@ -57,6 +58,11 @@ if ($MyInvocation.InvocationName -eq ".") {
5758
exit 0
5859
}
5960

61+
if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
62+
Get-Help
63+
exit 0
64+
}
65+
6066
$subsetCategory = $subsetCategory.ToLowerInvariant()
6167

6268
# VS Test Explorer support for libraries

installer.cmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
@echo off
2-
"%~dp0build.cmd" -subsetCategory installer %*
2+
setlocal
3+
4+
set _args=-subsetCategory installer %*
5+
if "%~1"=="-?" set _args=-help
6+
7+
"%~dp0build.cmd" %_args%

libraries.cmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
@echo off
2-
"%~dp0build.cmd" -subsetCategory libraries %*
2+
setlocal
3+
4+
set _args=-subsetCategory libraries %*
5+
if "%~1"=="-?" set _args=-help
6+
7+
"%~dp0build.cmd" %_args%

0 commit comments

Comments
 (0)