Skip to content

Commit

Permalink
clean: init cleaning script
Browse files Browse the repository at this point in the history
  • Loading branch information
stackmystack committed May 30, 2024
1 parent 82e3281 commit 9680ac4
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#! /usr/bin/env sh

list_parsers() {
langs=$(cut -d ':' -f 1 ref)
directories=""
for item in $langs; do
if [ -d "$item" ]; then
directories="$directories $item"
fi
done
echo "$directories"
}

directories_to_delete=$(list_parsers)

if [ -z "$directories_to_delete" ]; then
echo "Nothing to clean."
exit 0
fi

# Ask for confirmation
echo "Cleaning:"
echo ""
for dir in $directories_to_delete; do
echo " $dir/"
done
echo ""

read -p "Do you really want to delete these parsers? (y/n) " choice

case "$choice" in
y|Y )
for dir in $directories_to_delete; do
rm -rf "$dir"
echo "Deleted $dir"
done
;;
n|N )
echo "No directories were deleted."
;;
* )
echo "Invalid choice. No directories were deleted."
;;
esac

0 comments on commit 9680ac4

Please sign in to comment.