Reputation: 745
I'm wondering if it's possible to run arbitrary julia code via the command like similar to python:
python -c "print('stuff')"
or in R:
R -e '# do stuff'
because I'm building a docker container I'd like to be able to do something as shown above for Julia, currently I think I might be able to work around it like so:
&& echo 'packs=["Distributions", "CSV", "DataFrames", "ForwardDiff", "PyCall", "GLM"];for i in packs;Pkg.add(i);end' >> packs.jl \
&& julia packs.jl \
in the dockerfile, but then I wonder what if packages ask for permission like cario for example
Upvotes: 11
Views: 3380
Reputation: 1572
The following seems to work in Julia 0.6:
julia -e 'Pkg.add("DifferentialEquations.jl")'
With Julia 0.7-beta, it looks like you should do
julia -e 'using Pkg; Pkg.add("DifferentialEquations.jl")'
For multiple packages, you can use the dot suffix and provide a list.
Pkg.add.(["DifferentialEquations.jl", "Optim.jl"])
Upvotes: 14