|
#!/bin/bash |
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
TARGET_PATH="https://github.com/DeL-TaiseiOzaki/idebate_scraping.git" |
|
|
|
|
|
|
|
if [ ! -d "output" ]; then |
|
mkdir output |
|
fi |
|
|
|
|
|
if ! command -v python3 &> /dev/null; then |
|
echo "Error: Python3 is not installed" |
|
exit 1 |
|
fi |
|
|
|
|
|
if [[ $TARGET_PATH == http* ]] && [[ $TARGET_PATH == *github.com* ]]; then |
|
if ! command -v git &> /dev/null; then |
|
echo "Error: Git is not installed" |
|
exit 1 |
|
fi |
|
echo "Scanning GitHub repository: $TARGET_PATH" |
|
else |
|
if [ ! -d "$TARGET_PATH" ]; then |
|
echo "Error: Directory not found: $TARGET_PATH" |
|
exit 1 |
|
fi |
|
echo "Scanning local directory: $TARGET_PATH" |
|
fi |
|
|
|
|
|
echo "Starting directory scan..." |
|
python3 main.py "$TARGET_PATH" |
|
|
|
exit_code=$? |
|
|
|
if [ $exit_code -eq 0 ]; then |
|
echo "Scan completed successfully!" |
|
echo "Results are saved in the 'output' directory" |
|
else |
|
echo "Scan failed with exit code: $exit_code" |
|
exit $exit_code |
|
fi |