Skip to content

Instantly share code, notes, and snippets.

@bahodge
Created May 4, 2019 20:43
Show Gist options
  • Save bahodge/d41d93a8fc9f5fd2fa208788c2315672 to your computer and use it in GitHub Desktop.
Save bahodge/d41d93a8fc9f5fd2fa208788c2315672 to your computer and use it in GitHub Desktop.
Find or Create .formatter.exs script that makes one in the current directory
#!/bin/sh
current=$(pwd)
formatter_file=".formatter.exs"
echo $current
if [ -e $current/"$formatter_file" ];
then
mix format
echo "Formatting Complete"
else
echo "Creating .formatter.exs"
touch $current/.formatter.exs
echo '[inputs: ["{mix,.formatter}.exs", "./**/*.{ex,exs}"]]' > $current/.formatter.exs
mix format
echo "Formatting Complete"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment