How to start a repl with command line arguments?

I want to do this:

$ julia ?*HelloWorld?*
julia> ARGS
String["HelloWorld"]

But I can’t figure out how.

The following is not very pretty, but it works:

julia  -i -e "" -- HelloWorld

The -e "" says “run the contents of the empty string” (which does nothing, but tells the program not to expect a file name after the --). The -i says "drop into the REPL after running the argument of the -e".
If I do that, I can do

julia> ARGS
1-element Vector{String}:
 "HelloWorld"
7 Likes