Say my command line input is
$> elixir test.exs 1 2 3
I know i can use System.argv to get the argument variable but how can i also get the name of the script “test.exs” ?
Say my command line input is
$> elixir test.exs 1 2 3
I know i can use System.argv to get the argument variable but how can i also get the name of the script “test.exs” ?
To reply my own question and share with those who wants to know. You can use __ENV__.file
This will give you the fullpath though, i just need the filename with extension.
Path.basename(__ENV__.file)
will give you what you want. (If you have not figured it out yet).
Hey thanks man, that a lot more slick than __ENV__.file |> String.split("/") |> List.last
yes and will work on Windows (your solution will not)
Good point