* Add usage information to iex.bat Support command line switch '--help', '-h', '/h' and '/?' to show usage information for iex.bat. Check argument with '/I' to make the test case insensitive: This allows showing usage information with '--HELP', '-H' and '/H'. Use 'setlocal' and 'endlocal' so changes to the environment are local to the batch file (https://technet.microsoft.com/en-us/library/bb491001.aspx) - so there is no need to un-set __ELIXIR_IEX_FLAGS. * Use documented syntax 'goto label' - without leading colon before the label * Support cli switch '/?' to show help Use label :end to jump to the end of the batch file after showing help text - so the call to elixir.bat is not executed when showing help. Use 'setlocal' and 'endlocal' so that the env var 'argc' is local to this batch file. * Support cli switch '/?' to show help for elixir.bat Test for cli switch '/?' does not need to be case insensitive.
34 lines
1.1 KiB
Batchfile
34 lines
1.1 KiB
Batchfile
@if defined ELIXIR_CLI_ECHO (@echo on) else (@echo off)
|
|
setlocal
|
|
set argc=0
|
|
for %%A in (%*) do (
|
|
if /I "%%A"=="--help" goto documentation
|
|
if /I "%%A"=="-h" goto documentation
|
|
if /I "%%A"=="/h" goto documentation
|
|
if "%%A"=="/?" goto documentation
|
|
set /A argc+=1
|
|
)
|
|
if %argc%==0 goto documentation
|
|
goto run
|
|
|
|
:documentation
|
|
echo Usage: %~nx0 [elixir switches] [compiler switches] [.ex files]
|
|
echo.
|
|
echo -o The directory to output compiled files
|
|
echo --no-docs Do not attach documentation to compiled modules
|
|
echo --no-debug-info Do not attach debug info to compiled modules
|
|
echo --verbose Print compilation status
|
|
echo --warnings-as-errors Treat warnings as errors and return non-zero exit code
|
|
echo --ignore-module-conflict
|
|
echo.
|
|
echo ** Options given after -- are passed down to the executed code
|
|
echo ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS
|
|
echo ** Options can be passed to the Erlang compiler using ERL_COMPILER_OPTIONS
|
|
goto end
|
|
|
|
:run
|
|
call "%~dp0\elixir.bat" +elixirc %*
|
|
|
|
:end
|
|
endlocal
|