All Projects → inishchith → Autoenv

inishchith / Autoenv

Licence: mit
Directory-based environments

Programming Languages

shell
77523 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Autoenv

envrc-rs
Auto source bash .envrc of your workspace
Stars: ✭ 27 (-99.44%)
Mutual labels:  environment, cd, shell-extension
Enhancd
🚀 A next-generation cd command with your interactive filter
Stars: ✭ 2,049 (-57.83%)
Mutual labels:  zsh, shell-extension, cd
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (-55.46%)
Mutual labels:  zsh, cd
Modernish
Modernish is a library for writing robust, portable, readable, and powerful programs for POSIX-based shells and utilities.
Stars: ✭ 586 (-87.94%)
Mutual labels:  zsh, shell-extension
Bashhub Client
☁️ Bash history in the cloud. Indexed and searchable.
Stars: ✭ 858 (-82.34%)
Mutual labels:  zsh, shell-extension
Dotfiles
My OS X environment
Stars: ✭ 316 (-93.5%)
Mutual labels:  zsh, environment
czmod
🚀 Native Module Written in C to Boost z.lua !!
Stars: ✭ 35 (-99.28%)
Mutual labels:  zsh, cd
goto
Goto - The Good Way to Program
Stars: ✭ 14 (-99.71%)
Mutual labels:  zsh, cd
G
Simple go version manager, gluten-free
Stars: ✭ 307 (-93.68%)
Mutual labels:  zsh, environment
Fz
Cli shell plugin, the missing fuzzy tab completion feature of z jump around command.
Stars: ✭ 359 (-92.61%)
Mutual labels:  zsh, cd
Liquidprompt
A full-featured & carefully designed adaptive prompt for Bash & Zsh
Stars: ✭ 4,134 (-14.92%)
Mutual labels:  zsh
Spot mini mini
Dynamics and Domain Randomized Gait Modulation with Bezier Curves for Sim-to-Real Legged Locomotion.
Stars: ✭ 426 (-91.23%)
Mutual labels:  environment
Zsh Completions
Additional completion definitions for Zsh.
Stars: ✭ 4,907 (+0.99%)
Mutual labels:  zsh
Hyperzsh
A hyperminimal zsh prompt
Stars: ✭ 470 (-90.33%)
Mutual labels:  zsh
Ntfy
🖥️📱🔔 A utility for sending notifications, on demand and when commands finish.
Stars: ✭ 4,089 (-15.85%)
Mutual labels:  zsh
Gbt
Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go.
Stars: ✭ 457 (-90.59%)
Mutual labels:  zsh
Dotfiles
dotfiles for the developer happiness: macos, zsh, brew, vscode, codespaces, python, node, elixir
Stars: ✭ 408 (-91.6%)
Mutual labels:  zsh
Dotfiles
My macOS environment: zsh, Git, Visual Studio Code, etc.
Stars: ✭ 405 (-91.66%)
Mutual labels:  zsh
Symfony Console Completion
Automatic tab-key completion for Symfony console application options, arguments and parameters
Stars: ✭ 405 (-91.66%)
Mutual labels:  zsh
Slimzsh
Small, usable configuration for ZSH
Stars: ✭ 492 (-89.87%)
Mutual labels:  zsh

Autoenv: Directory-based Environments Build Status

Magic per-project shell environments

Note: you should probably use direnv instead. Simply put, it is higher quality software. But, autoenv is still great, too. Maybe try both? :)

This image sums up the relationship between the two projects, very well:

Image of text history

What is it?

If a directory contains a .env file, it will automatically be executed when you cd into it. When enabled (set AUTOENV_ENABLE_LEAVE to a non-null string), if a directory contains a .env.leave file, it will automatically be executed when you leave it.

This is great for...

  • auto-activating virtualenvs
  • auto-deactivating virtualenvs
  • project-specific environment variables
  • making millions

You can also nest envs within each other. How awesome is that!?

When executing, autoenv, will walk up the directories until the mount point and execute all .env files beginning at the top.

Usage

Follow the white rabbit:

$ echo "echo 'whoa'" > project/.env
$ cd project
whoa

Mind blown GIF

Install

Install it easily:

MacOS using Homebrew

$ brew install autoenv
$ echo "source $(brew --prefix autoenv)/activate.sh" >> ~/.bash_profile

Using Git

$ git clone git://github.com/inishchith/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc

Using AUR

Arch Linux users can install autoenv or autoenv-git with their favorite AUR helper.

You need to source activate.sh in your bashrc afterwards:

$ echo 'source /usr/share/autoenv/activate.sh' >> ~/.bashrc

Note that there was previously a pip installation option, but it is no longer recommended as the package is severely out of date

Configuration

Before sourcing activate.sh, you can set the following variables:

  • AUTOENV_AUTH_FILE: Authorized env files, defaults to ~/.autoenv_authorized
  • AUTOENV_ENV_FILENAME: Name of the .env file, defaults to .env
  • AUTOENV_LOWER_FIRST: Set this variable to a non-null string to flip the order of .env files executed
  • AUTOENV_ENV_LEAVE_FILENAME: Name of the .env.leave file, defaults to .env.leave
  • AUTOENV_ENABLE_LEAVE: Set this to a non-null string in order to enable source env when leaving
  • AUTOENV_ASSUME_YES: Set this variable to a non-null string to silently authorize the initialization of new environments

Shells

autoenv is tested on:

  • bash
  • zsh
  • dash
  • fish is supported by autoenv_fish
  • more to come

Alternatives

direnv is an excellent alternative to autoenv, and includes the ability to unset environment variables as well. It also supports the fish terminal.

https://direnv.net

Disclaimer

Autoenv overrides cd. If you already do this, invoke autoenv_init within your custom cd after sourcing activate.sh.

Autoenv can be disabled via unset cd if you experience I/O issues with certain file systems, particularly those that are FUSE-based (such as smbnetfs).

Attributions

Autoenv was originally created by @kennethreitz. Ownership was then transfered to @inishchith. As of August 22nd, 2021, Edwin Kofler (@hyperupcall) owns and maintains the project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].