Created
April 16, 2015 22:29
-
-
Save wende/1493441b5d7b5d3cdd11 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
| loadAll = fn(dir) -> | |
| dir | |
| |> Path.join("**/*.ex") | |
| |> Path.wildcard() | |
| |> Enum.map(&Code.require_file/1) | |
| end | |
| formatResult = fn({exists, one, multi}) -> | |
| [exists, one, Enum.join(multi, ",")] |> (&(Enum.join(&1, "|"))).() | |
| end | |
| execute = fn | |
| ("l", input) -> Code.require_file(input) | |
| ("a", input) -> IEx.Autocomplete.expand Enum.reverse to_char_list(input) | |
| end | |
| loop = fn(y) -> | |
| [command, input] = IO.gets("") |> String.split | |
| IO.puts formatResult.(execute.(command, input)) <> "\nok." | |
| y.(y) | |
| end | |
| [first|_] = System.argv() | |
| loadAll.(first) | |
| loop.(loop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment