This commit is contained in:
ramzcaca 2026-02-05 11:19:48 +01:00
parent 1a52ef7f9f
commit 940a765851

View File

@ -20,7 +20,7 @@ fi
create_venv() {
if [ -z "$venv_path" ]; then
echo "No virtual environment found."
read -p "Type the name of your venv: " name < /dev/tty
read -p "Type the name of your venv: " name
echo "Creating virtual environment: $name"
python3 -m venv "$name"
venv_path="./$name"
@ -30,12 +30,14 @@ create_venv() {
# --- Add venv to .gitignore
gitignore() {
if [ -f .gitignore ] && grep -qx "$venv_path" .gitignore; then
return
if [ -f .gitignore ]; then
if grep -qx "$venv_path" .gitignore; then
return
fi
fi
echo "Do you want to add the venv to .gitignore? (recommended)"
read -p " y / n " choice < /dev/tty
read -p " y / n " choice
if [ "$choice" = "y" ]; then
echo "$venv_path" >> .gitignore
echo "Added $venv_path to .gitignore"
@ -59,7 +61,7 @@ activate_venv() {
requirements() {
if [ -n "$existing_req" ]; then
echo "requirements.txt detected. Install dependencies?"
read -p " y / n " choice < /dev/tty
read -p " y / n " choice
if [ "$choice" = "y" ]; then
pip install -r "$existing_req"
echo "Dependencies installed"
@ -67,15 +69,14 @@ requirements() {
fi
}
# --- Install one package
# --- Install packages interactively
installer() {
read -p "Type the package you need to install: " package < /dev/tty
read -p "Type the package you need to install: " package
pip install "$package"
}
# --- Alfred logic (first question + follow-ups)
alfred() {
read -p "Do you want to install a package? (y / n) " choice < /dev/tty
read -p "Do you want to install a package? (y / n) " choice
if [ "$choice" != "y" ]; then
return
fi
@ -83,7 +84,7 @@ alfred() {
installer
while true; do
read -p "Do you want to install another package? (y / n) " choice < /dev/tty
read -p "Do you want to install another package? (y / n) " choice
if [ "$choice" = "y" ]; then
installer
else
@ -92,6 +93,7 @@ alfred() {
done
}
# ------------------ MAIN ------------------
create_venv
@ -104,3 +106,4 @@ echo ""
echo "Your venv is ready!"
echo "To activate it later, run:"
echo "source \"$venv_path/bin/activate\""