-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82e3281
commit 9680ac4
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 | ||
|