Is there a good way to specify projects for command line Julia scripts? e.g. I have a script foo.jl that is intended to be called from the command line: how do I ensure that it gets the correct Project.toml file (which, for the time being, we assume resides in the same directory as the script), and ideally instantiate the Project if it hasn’t already?
The best I’ve come up with so far is to start my scripts with
#!/usr/bin/env julia
using Pkg
Base.ACTIVE_PROJECT[] = @__DIR__ # Pkg.activate(@__DIR__) creates an annoying message
Pkg.instantiate()
This seems like overkill (not to mention uses an internal variable). Is there a better way to do this?