-
-
Save nivertech/7239191 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule CommandSigil do | |
| # I chose 't' for 'terminal'. I wanted 'c' for 'command', but it's taken. | |
| def sigil_t(cmd, _opts) do | |
| { :ok, list } = String.to_char_list(cmd) | |
| :os.cmd(list) | |
| end | |
| end | |
| defmodule CommandSigil.Test do | |
| import CommandSigil | |
| def test_sigil do | |
| %t"ls -l" | |
| end | |
| def test_sigil_with_var do | |
| dir = "~/" | |
| %t"ls -al #{dir}/*" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment