README.md
# ExactoKnife

[](https://hex.pm/packages/exacto_knife)
[](https://hexdocs.pm/exacto_knife/)
[](https://hex.pm/packages/exacto_knife)
[](https://github.com/jeremylightsmith/exacto_knife/blob/master/LICENSE)
[](https://github.com/jeremylightsmith/exacto_knife/commits/master)
Refactoring tools for elixir!
## Refactorings
### Refactoring: Sort aliases
```
> mix refactor sort_aliases [FILE]
```
Sort all aliases in a file:
```elixir
alias Alpha
alias Alpha.Bravo
alias Alpha.Charlie
alias Delta
```
----
### Refactoring: Expand aliases
```
> mix refactor expand_aliases [FILE]
```
Expand out all aliases in a file:
```elixir
alias Foo.Bar.Baz
alias Foo.Bar.Boom
```
----
### Refactoring: Consolidate aliases
```
> mix refactor consolidate_aliases [FILE]
```
Sort and combine all aliases in a file:
```elixir
alias Foo.Bar.{Baz, Boom}
```
More to come...
----
## Running against a codebase
Find is your friend
```
> find lib -type f -name "*.ex*" | xargs -n1 mix refactor sort_aliases
```
## Installation
Exacto Knife can be installed by adding `exacto_knife` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:exacto_knife, "~> 0.1.3"}
]
end
```
Docs can be found at <https://hexdocs.pm/exacto_knife>.
----
## Contributing
* Clone the repo
* Write a failing test for your change
* Make sure all tests pass
* Submit a PR
* We all win!!!
### Links
* [Elixir Syntax Reference](https://hexdocs.pm/elixir/syntax-reference.html#the-elixir-ast) has a good intro to the AST.
* [Sourceror Docs](https://hexdocs.pm/sourceror/readme.html) are pretty great, understanding their zippers is essential.
* [AST Ninja](https://ast.ninja/) will show you the ast for specific code.