#!/usr/bin/env bash
# This is our code autoformatting tool. It's run on all code files and runs Black, isort and
# whatever other code-fixing tools we decide to use.
#
# Usage: autoformat <file_or_folder_1> [<file_or_folder_2> ...]
# Note this expects Black and isort to be in you path.

if (( $# < 1 )); then
    echo 'Usage: autoformat <file_or_folder_1> [<file_or_folder_2> ...]'
    exit 1
fi

# isort must be run before Black
echo 'Running isort'
isort -rc "$@"
echo 'Running Black'
black --line-length 100 --target-version py35 "$@"
