| Crates.io | durrrrrenv |
| lib.rs | durrrrrenv |
| version | 0.1.0 |
| created_at | 2025-10-20 18:36:10.36077+00 |
| updated_at | 2025-10-20 18:36:10.36077+00 |
| description | A zsh alternative to direnv that automatically loads environment configurations when you enter a directory |
| homepage | https://github.com/i2cjak/durrrrrenv |
| repository | https://github.com/i2cjak/durrrrrenv |
| max_upload_size | |
| id | 1892524 |
| size | 57,995 |
A zsh alternative to direnv that automatically loads environment configurations when you enter a directory.
.local_environment files.local_environment files change and re-prompts for approvalcargo build --release
sudo cp target/release/durrrrrenv /usr/local/bin/
Add this to your ~/.zshrc:
eval "$(durrrrrenv hook)"
Create a .local_environment file in your project directory with commands to execute:
# Example .local_environment
source ~/scripts/setup.sh
python_venv .venv
source <(west completion zsh)
source <file>Source a shell script file.
source ~/.bashrc
source ./scripts/setup.sh
python_venv [path]Activate a Python virtual environment. Defaults to .venv if no path is provided.
python_venv # Uses .venv
python_venv venv # Uses venv directory
source <(command)Process substitution - execute a command and source its output.
source <(west completion zsh)
source <(kubectl completion zsh)
When you cd into a directory with a .local_environment file for the first time, you'll see:
durrrrrenv: .local_environment file found but not allowed
durrrrrenv: Run 'durrrrrenv allow' to allow it
durrrrrenv: File contents:
---
source ~/setup.sh
python_venv .venv
---
To allow the file and execute it immediately:
eval "$(durrrrrenv allow)"
You'll be prompted to confirm:
Contents of .local_environment:
---
source ~/setup.sh
python_venv .venv
---
Allow this file to be executed? [y/N]: y
Allowed .local_environment in /home/user/project
The environment will be loaded immediately after you confirm. If you don't want to execute it immediately, just run durrrrrenv allow without the eval wrapper.
durrrrrenv checkCheck if the current directory has an allowed .local_environment file and execute it. This is called automatically by the zsh hook.
durrrrrenv check
durrrrrenv allowAllow the .local_environment file in the current directory. After allowing, it outputs the shell script to stdout, which you can execute immediately with eval.
eval "$(durrrrrenv allow)" # Allow and execute immediately
# or
durrrrrenv allow # Just allow without executing
durrrrrenv denyRemove permission for the .local_environment file in the current directory.
durrrrrenv deny
durrrrrenv statusShow the status of the current directory's .local_environment file.
durrrrrenv status
Output:
Directory: /home/user/project
Status: Allowed
Commands to execute:
Source { path: "~/setup.sh" }
PythonVenv { path: ".venv" }
durrrrrenv hookOutput the zsh hook script (used in eval "$(durrrrrenv hook)").
durrrrrenv benchBenchmark the performance of directory search operations.
durrrrrenv bench # Run 1000 iterations (default)
durrrrrenv bench -n 10000 # Run 10000 iterations
Output shows average time per search, searches per second, and search depth statistics.
durrrrrenv check --verboseCheck with detailed performance metrics.
durrrrrenv check --verbose
Shows search time, depth found, and total execution time.
durrrrrenv is designed for minimal overhead on every directory change:
MAX_SEARCH_DEPTH)Path references instead of cloning PathBufs during search.local_environment is found or max depth reachedHook Optimizations:
.local_environment in shell before spawning binary[[ ]] and parameter expansion${(@f)output}The hook only calls durrrrrenv check when:
.local_environment file exists within 5 parent directoriesUse durrrrrenv bench to measure performance on your system.
cd into a directory, the zsh hook runs durrrrrenv checkdurrrrrenv check searches for a .local_environment file:
.local_environment filecd directly into my-project/src/lib/utils/ and it will find and load my-project/.local_environment.local_environment file is found:
~/.config/durrrrrenv/allowed.json.local_environment file changes after being allowed, you'll be prompted againAllowed directories are stored in: ~/.config/durrrrrenv/allowed.json
This file contains:
# Create a new project
mkdir my-project
cd my-project
# Create a .local_environment file
cat > .local_environment << 'EOF'
python_venv .venv
source <(west completion zsh)
EOF
# On next cd, you'll be prompted
cd ..
cd my-project
# durrrrrenv: .local_environment file found but not allowed
# durrrrrenv: Run 'durrrrrenv allow' to allow it
# Allow it and execute immediately
eval "$(durrrrrenv allow)"
# Allow this file to be executed? [y/N]: y
# Allowed .local_environment in /home/user/my-project
# (.venv) is now activated and west completion is loaded immediately!
# It also auto-loads on cd
cd ..
# (.venv) is automatically deactivated when leaving!
cd my-project
# (.venv) is activated again
# Subdirectories keep the environment active
cd subdir
# (.venv) still active
cd ../..
# (.venv) deactivated when fully leaving the project
cd my-project
# Check status anytime
durrrrrenv status
# Directory: /home/user/my-project
# Status: Allowed
# Parent directory search - cd directly into deep subdirectory
cd /tmp
mkdir -p my-project/src/lib/utils
cd my-project/src/lib/utils
# (.venv) is activated! Searched up and found /tmp/my-project/.local_environment
PROVIDED BY AMERICAN EMBEDDED
Hardtech Consulting
Specialists in low power IoT design, wearable applications, high-speed applications.
MIT