Created
February 7, 2026 21:41
-
-
Save lmmx/9b4f9370354faaaec03178d269fdb45e to your computer and use it in GitHub Desktop.
Ascend to the dir containing a .venv
This file contains hidden or 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
| vcd() { | |
| local dir="$PWD" | |
| while [[ "$dir" != "/" ]]; do | |
| if [[ -d "$dir/.venv" ]]; then | |
| cd "$dir" || return | |
| return | |
| fi | |
| dir="$(dirname "$dir")" | |
| done | |
| echo "vcd: no .venv directory found in parent tree" >&2 | |
| return 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment