I often need to start julia
, enter the Pkg REPL to add and remove packages and then exit. I’m a lazy person, so is often too much work for me to do:
julia --project
julia> ]
pkg> add Foo Bar
pkg> rm SomePkg
julia> exit()
Because of this, i created a simple shell script (at ~/.julia/bin
) that allows me to use the Pkg REPL mode directly from the terminal without starting julia first, doing something and then exiting.
The script is something like:
#!/bin/bash
args="$@"
code="using Pkg; Pkg.REPLMode.PRINTED_REPL_WARNING[] = true; pkg\"$args\""
eval "julia --project -q --startup-file=no --history-file=no -e '$code'"
And then we can use like this:
script add Foo Bar
script rm SomePkg
Is there something “wrong” about doing things this way? Because i was thinking in create a simple package
to automatically generate this script (with the windows version too) and then install in the ~/.julia/bin
directory.