Skip to content

Instantly share code, notes, and snippets.

@manuelgeek
Forked from bahodge/mix_format_script.sh
Created August 18, 2021 13:36
Show Gist options
  • Save manuelgeek/69b83a1f8cb039a077dd9c398477eac3 to your computer and use it in GitHub Desktop.
Save manuelgeek/69b83a1f8cb039a077dd9c398477eac3 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