Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line length script update #99

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.pdf
*.synctex.gz
Everything.agda
/env/
29 changes: 26 additions & 3 deletions check-line-lengths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,31 @@
# originally written by Steven Schaefer <stschaef>

error=0
shopt -s globstar nullglob
for file in **/*.agda; do

VENV_DIR="env"

# Check if the virtual environment directory exists
if [ ! -d "$VENV_DIR" ]; then
echo "Virtual environment does not exist. Creating one now..."
# Create the virtual environment with python3
python3 -m venv "$VENV_DIR" || { echo "Failed to create virtual environment."; exit 1; }

fi

source "$VENV_DIR/bin/activate"

if [ $? -ne 0 ]; then
echo "Error: Unable to activate the virtual environment."
exit 2
fi

echo "Virtual environment activated."

pip3 install wcwidth || { echo "Failed to install wcwidth."; exit 3; }

echo "Package 'wcwidth' has been successfully installed in the virtual environment."

while IFS= read -r -d '' file; do
python3 -c '
import sys
from wcwidth import wcswidth
Expand All @@ -18,5 +41,5 @@ except Exception as e:
print(f"Error processing {filename}: {e}")
sys.exit(1)
' "${file}" || error=1
done
done < <(find . -name '*.agda' -print0)
exit ${error}
Loading