Skip to content

Commit da402a7

Browse files
authored
Merge pull request #47 from juergenhoetzel/github-webintaller-windows-fix
Fix argument parsing issue for Windows github web-installer
2 parents e035888 + 53ab65d commit da402a7

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

webinstall/github-eldev.bat

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
rem This script downloads Eldev startup script as `USERPROFILE/.eldev/bin/eldev'
2-
rem for use in a GitHub workflow.
3-
rem
4-
rem curl.exe is included in Windows 10 since April-2018-Update (1803)
5-
rem In your `.github/workflows/*.yml' add this:
6-
rem
7-
rem run: curl.exe -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev.bat | cmd
8-
rem
9-
10-
rem optionally pass download URL as paramater to allow testing in eldev PRs
11-
IF [%1] == [] (
12-
set URL=https://raw.githubusercontent.com/doublep/eldev/master/bin/eldev.bat
13-
) else (
14-
set URL=%1
15-
)
16-
17-
set ELDEV_BIN_DIR=%USERPROFILE%\.eldev\bin
18-
19-
mkdir %ELDEV_BIN_DIR%
20-
21-
curl.exe -fsSL %URL% -o %ELDEV_BIN_DIR%\eldev.bat
22-
23-
echo %ELDEV_BIN_DIR% >> %GITHUB_PATH%
24-
1+
@echo off
2+
rem This script downloads Eldev startup script as `%USERPROFILE%/.eldev/bin/eldev'.
3+
rem
4+
rem curl.exe is included in Windows 10 since April-2018-Update (1803)
5+
rem In your `.github/workflows/*.yml' add this:
6+
rem
7+
rem curl.exe -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev.bat | cmd /Q
8+
9+
rem The usual way to check for the presence of an argument is to test
10+
rem if their argument reference %[1-9] has a value. Though when piping
11+
rem to cmd, these references do not exist and instead is better to use
12+
rem a counter.
13+
set ARGS=0
14+
for %%x in (%*) do set /A ARGS+=1
15+
16+
rem optionally pass download URL as parameter to allow testing in PRs
17+
set URL=https://raw.githubusercontent.com/doublep/eldev/master/bin/eldev.bat
18+
if %ARGS%==1 set URL=%1
19+
20+
set ELDEV_BIN_DIR=%USERPROFILE%\.eldev\bin
21+
22+
mkdir %ELDEV_BIN_DIR%
23+
24+
curl.exe -fsSL %URL% -o %ELDEV_BIN_DIR%\eldev.bat || exit /b
25+
26+
echo %ELDEV_BIN_DIR% >> %GITHUB_PATH%
27+

0 commit comments

Comments
 (0)