Bash: source venv on startup

This commit is contained in:
Akemi Izuko 2025-01-24 10:31:57 -07:00
parent 02a8705c0a
commit 45118f095e
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
2 changed files with 4 additions and 3 deletions

View file

@ -434,10 +434,9 @@ loadvenv() {
while [[ "$PWD" != "/" ]]; do while [[ "$PWD" != "/" ]]; do
for x in $(fd -HI -td --maxdepth=1); do for x in $(fd -HI -td --maxdepth=1); do
if [[ "$x" == '.venv/' || "$x" == 'venv/' ]]; then if [[ -f "$x/bin/activate" ]]; then
source "${x}/bin/activate" source "${x}/bin/activate"
cd "$init_dir" break 2
return
fi fi
done done

View file

@ -99,4 +99,6 @@ fi
# Bash completion ==== # Bash completion ====
source_completion_scripts source_completion_scripts
loadvenv
# vim: set ft=bash ff=unix: # vim: set ft=bash ff=unix: