Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Pass Julia arguments to be executed in REPL?

I very (very!) often do this routine in my daily work:

$ j7 # (alias for Julia version 1.7)
julia>
julia> ] activate .
(or similarly) (@v1.8) pkg> activate . 
Activating project at `~/MyMWE_WorkingPath`
julia> using Revise ; using RRSP # RRSP is my working module

I would like to have an alias for doing this routine quicker and easilier. I do it at the very least ten times a week and will do it for months more.

Ideally, I would do something like, j7RRSP which is an alias for:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

alias j7RRSP='julia > ]activate . ; using Revise ; using RRSP'

This is incorrect and I don’t know how to do it well!
I know alias for executing julia files are possible :

alias j7jl='julia somefiles.jl'

In my case, I am activating a project then using two packages, Revise, which is standard, then RRSP that I created.

>Solution :

Here is one solution:

alias j7RRSP='julia --project=. -e "using Revise, RRSP" -i'

Flags:

  • --project=.: start with the project in the current directory directly instead of using ]activate .,
  • -e "...": evaluate the code ...,
  • -i: ask for an interactive session, this is needed since otherwise, due to combining with -e, the process exits after evaluating the code.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading