Does anyone know a good way to retrieve the current elixir version on your system without running elixir --version?
I’m looking into modifying starship’s elixir version retrieval to stop doing that because running elixir --version will result in booting the Erlang VM and is extremely slow.
I know > v1.13 has --short-version that’s a faster alternative, but are there other ways of getting a similar result while also can be backwards compatible?
Does it necessarily have to be with the elixir command? If user already elixir installed so System.version returns the same result as elixir --short-version, so you can have:
I’m just bashing the keyboard, but there seems to be a VERSION file you can read, if you can find the installation. Confirmed it’s present on 1.11 and also in the precompiled packages.
Oh nice, I didn’t know there’s an elixir.app either!
This does looks like it can get pretty complicated pretty quickly due to having to check multiple files.
Check elixir --short-version and if it doesn’t succeed, use elixir --version? So those who update have the fast path, others can update if they need it.