I want to run a command in a mix project directory that echos the version of the project. I know I can accomplish this with a custom mix task, but is there already a tool to echo project metadata, like the version number?
Will something like this work?
$ mix run -e "IO.inspect Mix.Project.config()[:version]"
There’s quite a few other keys beside just
:version of course.
Yes. Certainly, thank you. I can imagine a number ways like the one you’ve given. I was just curious if there was already a command for querying the project in the current directory that I had missed when I read over the documentation.
Ah, I see. There aren’t any prebuilt commands as far as I know. Although if you did create a command you could install it globally on your servers (similar to how
mix phx is installed), although perhaps that’s what you meant by “custom mix task”.