Open fredrikekre opened 5 years ago
You can use this to make a template for jlpkg: jlpkg.zip
The main trick is to add the following to the top of a .cmd file:
@eval 1 #= 2>nul
@call julia "%~dp0%~n0.cmd" %*
@exit /b %errorlevel%
=#
@eval 1 #= 2>nul
@
sign suppresses this line to not be echod to the console and the 2>nul
part suppresses any errors. Otherwise you would see 'eval' is not recognized as an internal or external command
#=
as the start of a multi line comment block. @call julia "%~dp0%~n0.cmd" %*
jlpkg
and not jlpkg.cmd
). Julia will simply skip over the cmd header and start executing the julia part of the file.@exit /b %errorlevel%
Just replace the @call julia "%~dp0%~n0.cmd" %*
part with the following juxtaposed string when generating the cmd file: "@call $(julia) $(join(julia_flags, ' ')) $(abspath(@__DIR__, "cli.jl")) %*"
Similarly to what you have here https://github.com/fredrikekre/jlpkg/blob/aa44f0fa88b2450d73365f4a797c4cd7d6d301c4/src/jlpkg.jl#L43
Otherwise stuff break when the source code of jlpkg is removed.