Re:CLI: Improved
by carlmr on Friday August 31, 2018 @02:39AM
(#17883422)
Also don't forget Cargo. It makes it so much easier to work with than installing C/C++ dependencies.
[ Parent
| on HN ]
Cargo is awesome too. Cargo reminds me of Mix (from the Elixir ecosystem). The one thing that Mix has on Cargo is that it is super simple and straight forward to extend Mix. Cargo may be the same way but from what I've seen it seems more complicated.
Re:CLI: Improved
by steveklabnik on Friday August 31, 2018 @10:01AM
(#17885629)
That’d make sense given the common ancestry in Bundler :)
Do you have any docs on what you mean by extensibility here? I’m curious!
Sure! Take a look at Mix.Task [0]. You basically name your module Mix.Tasks.X where X is whatever you want the command to be and then include "use Mix.Task" and implement the run function and you have now extended Mix. You call the task my running "mix X" and it will run the code in the run function. I created a small task that generates ORM models for Ecto (Elixir's de facto ORM library) using Mix tasks [1]. So the user types mix plsm and they can generate the code.
[0] https://hexdocs.pm/mix/Mix.Task.html [1] https://github.com/jhartwell/Plsm
Re:CLI: Improved
by steveklabnik on Friday August 31, 2018 @01:50PM
(#17887535)
Ah ha! Thanks. So yeah, if you have an executable in your PATH named cargo-foo, then “cargo foo” will execute it. But we’re planning on having that style of functionality in the future as well, the cod name is “tasks”, but it still doesn’t have an RFC.