meld logo

Meld is a command-line utility that makes it easy to provide a mix task as a global command, enabling real CLIs.

Usage

meld link ./my_mix_project mix_task

Where '/.my_mix_project' is a directory containing an Elixir app with a mix task that can be run. 'mix_task' is the mix task name, that means that it can be run with 'mix mix_task'.

Meld will create a shell script in its directory at ~/.meld. This shell script will cd into the specified directory and run the mix task. By adding the Meld directory to the global PATH, a simulated global executable is achieved.

The default name is DIRECTORY-NAME_MIX-TASK-NAME. So, in our example, the script name would be my_mix_project_mix_task (I hope you don't name your projects like that). You can, however, override the default name. Just run meld help link for more info.

There's also a screencast for explaining the linking process:

[ asciicast ] (https://asciinema.org/a/6ioj040r61jzewsej5cktah94)

Usage as library

Meld.link "./my_mix_project", "mix_task" # to link
Meld.unlink "mix_task" # to unlink

Installation

You need Elixir with Erlang OTP installed.

On OSX:

  1. brew tap stuffs/tap to tap to where the meld formula is located.
  2. brew install meld (if that doesn't work, brew install stuffs/tap/meld).
  3. meld setup to create the ~/.meld folder.

As a one-liner, that's:

brew tap stuffs/tap; brew install meld; meld setup

On Linux:

  1. Run curl -kLO https://cdn.rawgit.com/sup/meld/releases/download/0.1.2/meld to download the binary.
  2. Make it executable: chmod +x ./meld
  3. Next, move it into your PATH somewhere. You can symlink it into /usr/local/bin or somewhere else, or just move it there. But of course, you can also use it if it's not in the PATH. Run either:
  1. Now, run meld setup (or ./meld setup if it's not in the PATH). This creates the Meld script directory under ~/.meld, under which all linked scripts are going to be saved.
  2. Make sure that the ~/.meld folder is in your PATH and has the correct rights assigned to it (chmod 755 ~/.meld).

And that's it! You're ready to link some tasks!

License

MIT, see LICENSE.