-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveVenvs.sh
More file actions
49 lines (42 loc) · 1.07 KB
/
removeVenvs.sh
File metadata and controls
49 lines (42 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
show_menu() {
echo "Now I'm gonna delete the venvs, please select your venv manager: "
echo "1) Poetry"
echo "2) Pipenv"
}
deletFiles() {
local MANAGER=$1
read -p "Are you sure want to delete the $MANAGER cache? (y/n, default y): " confirm
if [[ "${confirm:-y}" == [yY] ]]; then
if [[ $MANAGER == "poetry" ]]; then
DIR="/users/$USER/Library/Caches/pypoetry/virtualenvs/*"
elif [[ $MANAGER == "pipenv" ]]; then
DIR="/Users/$USER/.local/share/virtualenvs/*"
else
echo "Invaild name"
return 1
fi
if [[ -n "$ZSH_VERSION" ]]; then
setopt rm_star_silent
fi
rm -rf $DIR
if [[ -n "$ZSH_VERSION" ]]; then
unsetopt rm_star_silent
fi
echo "Deleted successfully"
else
echo "Operation cancelled"
fi
}
show_menu
read -p "Enter your choice [1-2]: " choice
case $choice in
1)
deletFiles "poetry"
;;
2)
deletFiles "pipenv"
;;
*)
echo "Invalid choice. Please enter a number between 1-2"
esac