A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/hyperupcall/autoenv below:

GitHub - hyperupcall/autoenv: Directory-based environments.

Autoenv: Directory-based Environments

Magic per-project shell environments.

If a directory contains an .env file, it will automatically be executed when you cd into it. And, if a directory contains an .env.leave file (and AUTOENV_ENABLE_LEAVE is a non-empty string), the file will automatically be executed when cd'ing away from the directory that contains that file.

This is great for...

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.

Follow the white rabbit:

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

# with cURL
curl -#fLo- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh

# with wget
wget --show-progress -o /dev/null -O- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh

If you encounter some variant of a curl: command not found or wget: command not found error, please install either cURL or wget (with your package manager) and try again.

When installing manually, you first install autoenv with either Homebrew, npm, or Git. Then, you run a command to ensure autoenv is loaded when you open a terminal (this command depends on your default shell).

Note that depending on your shell and operating system, you may need to write to .zprofile instead of .zshrc, or write to .bash_profile instead of .bashrc (or visa-versa).

Prefer this if you're running macOS. Homebrew must be installed.

Click to expand content

First, download the autoenv homebrew formulae:

Then, execute one of the following to ensure autoenv is loaded when you open a terminal:

# For Zsh shell (on Linux or macOS)
$ printf '%s\n' "source $(brew --prefix autoenv)/activate.sh" >> "${ZDOTDIR:-$HOME}/.zprofile"

# For Bash shell (on Linux)
$ printf '%s\n' "source $(brew --prefix autoenv)/activate.sh" >> ~/.bashrc

# For Bash shell (on macOS)
$ printf '%s\n' "source $(brew --prefix autoenv)/activate.sh" >> ~/.bash_profile

Prefer this if you're running Linux or an unsupported version of macOS. npm must be installed (usually through NodeJS).

Click to expand content

First, download the @hyperupcall/autoenv npm package:

$ npm install -g '@hyperupcall/autoenv'

Then, execute one of the following to ensure autoenv is loaded when you open a terminal:

# For Zsh shell (on Linux or macOS)
$ printf '%s\n' "source $(npm root -g)/@hyperupcall/autoenv/activate.sh" >> "${ZDOTDIR:-$HOME}/.zprofile"

# For Bash shell (on Linux)
$ printf '%s\n' "source $(npm root -g)/@hyperupcall/autoenv/activate.sh" >> ~/.bashrc

# For Bash shell (on macOS)
$ printf '%s\n' "source $(npm root -g)/@hyperupcall/autoenv/activate.sh" >> ~/.bash_profile

Use this if you cannot install with Homebrew or npm.

Click to expand content

First, clone this repository:

$ git clone 'https://github.com/hyperupcall/autoenv' ~/.autoenv

Then, execute one of the following to ensure autoenv is loaded when you open a terminal:

# For Zsh shell (on Linux or macOS)
$ printf '%s\n' "source ~/.autoenv/activate.sh" >> "${ZDOTDIR:-$HOME}/.zprofile"

# For Bash shell (on Linux)
$ printf '%s\n' "source ~/.autoenv/activate.sh" >> ~/.bashrc

# For Bash shell (on macOS)
$ printf '%s\n' "source ~/.autoenv/activate.sh" >> ~/.bash_profile

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

We recommend setting the following configuration variables:

AUTOENV_ENABLE_LEAVE=yes
AUTOENV_VIEWER=cat

These options are not set by default as to conform to the expectations of backwards-compatible behavior.

Inside the .env file, two environment variables can be accessed:

autoenv is tested on:

Autoenv overrides cd (unless AUTOENV_PRESERVE_CD is set to a non-empty string). If you already do this, invoke autoenv_init within your custom cd after sourcing activate.sh.

If you define a cd alias, autoenv will (properly) show an error except when using Zsh. We recommend removing any aliases to cd! (unalias cd).

If you are using dash, autoenv will work. However, dash does not support builtin. As a result, in dash, autoenv invokes chdir instead of cd to prevent infinite loops.

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

To uninstall autoenv, see ./docs/uninstall.md.

To update autoenv, see ./docs/updating.md.

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4