I want to create some CLI applications in julia, but instead of the users writing (in the terminal):
julia --project /path-to/src/MyScript.jl arg1 --opt-1
I want to be able to type:
myscript arg1 --opt-1
I want to create some CLI applications in julia, but instead of the users writing (in the terminal):
julia --project /path-to/src/MyScript.jl arg1 --opt-1
I want to be able to type:
myscript arg1 --opt-1
On UNIX-like OSes, create a shell script called myscript
that passes its arguments to the Julia command, then make that script executable. On Windows, no idea how to do that, sorry.
Well, on Windows you can write a .bat file…
Take a look at this one in the FAQs https://docs.julialang.org/en/v1/manual/faq/#How-do-I-pass-options-to-julia-using-#!/usr/bin/env?
You also may be interested in ArgParse.jl.
I tested here, and we can actually create a .bat file that calls julia passing the correct arguments, and run it in the terminal like a normal command, assuming that the script is on a folder which is on PATH. Also, we can actually use the unix approach in Windows if the user uses git-bash (I use git-bash with zsh). Thanks everyone!