Last active
May 17, 2021 07:37
-
-
Save jaumef/3b154a572fce2b54c2aee00843bc6834 to your computer and use it in GitHub Desktop.
Check status of repo and reformat + check typing
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
#!/bin/bash | |
# Link/copy this file to your bin folder so you can run this easily | |
# | |
# ln -s $PWD/status.sh ~/.local/bin/status | |
pyfiles=$(git status -s | grep -vE '^ ?[DR] ' | awk {'print $2'} | grep '.py') | |
if [[ $pyfiles ]] | |
then | |
# Do you need to activate the virtualenv before | |
# running black/mypy. Do it here! | |
# It will deactivate when it finishes, | |
# so you can have your 'check' virtualenv | |
# | |
# source ~/.venv/myenv/bin/activate | |
source ~/env/requestmachine/bin/activate | |
nix run -c black -l 100 $pyfiles | |
nix run -c mypy $pyfiles | |
fi | |
git status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment