Install
Envprobe requires at least Python 3.6 to be installed on the system. Apart from Python and one of the supported POSIX-compatible shells, there are no additional dependencies.
Obtaining Envprobe
You can download Envprobe’s official releases from PyPI.
pip
will automatically install Envprobe to an appropriate location for your local user.
pip install envprobe
From GitHub
You can download Envprobe from the official repository, either using Git or a tar
download.
Extract the downloaded archive to any location comfortable.
In the documentation, we will use ~/envprobe
as the location where Envprobe is installed to.
git clone http://github.com/whisperity/envprobe.git ~/envprobe \
--origin upstream --single-branch --branch master --depth 1
mkdir ~/envprobe
wget http://github.com/whisperity/envprobe/tarball/master -O envprobe.tar.gz
tar xzf envprobe.tar.gz --strip-components=1 -C ~/envprobe/
Setting up the shell hook
Envprobe can work its “magic” and apply the changes to the running shell’s environment through a hook which is executed every time a prompt is generated. This hook must be registered for the executed shell before using Envprobe. The easiest way to have the hook registered is by adding the invocation of Envprobe’s hook generator to the configuration file of the shell you are using.
Warning
Envprobe’s hook execution at the start of the shell involves considering the environment as-is at that moment to be the initial state used by the saved snapshots feature. Because scripts loaded after Envprobe can change the state of environment and result in otherwise unintended, automated changes picked up by Envprobe as if the user made them, it is well-advised to load Envprobe last.
Bash
Put the following code as-is (including quotes, etc.) at the end of ~/.bashrc
:
# If obtained from PyPI:
eval "$(envprobe config hook bash $$)";
# If obtained from GitHub:
eval "$(~/envprobe/envprobe config hook bash $$)";
Zsh
Stock Zsh
Put the following code as-is (including quotes, etc.) at the end of ~/.zshrc
:
# If obtained from PyPI:
eval "$(envprobe config hook zsh $$)";
# If obtained from GitHub:
eval "$(~/envprobe/envprobe config hook zsh $$)";
Zsh with Oh-My-Zsh
If you are using Oh-My-Zsh to manage your Zsh, create a new file ~/.oh-my-zsh/custom/zzzzzz_envprobe.zsh
with the following contents as-is (including quotes, etc.):
# If obtained from PyPI:
eval "$(envprobe config hook zsh $$)";
# If obtained from GitHub:
eval "$(~/envprobe/envprobe config hook zsh $$)";
Testing the hook
If Envprobe is successfully installed, the hook code itself will register the shell functions envprobe
, and envprobe-config
, and their shorthand aliases ep
, and epc
, for the main mode and config mode, respectively.
After adding the hook script to your configuration, start a new shell, and type in ep
.
If something similar to the following is visible on the screen (instead of a “bash: Command not found” or a “python: No module named” error), Envprobe is working as intended:
$ ep
usage: envprobe [-h] ...
Officially supported configuration
Below are the configuration combinations that the continuous integration testing is done for. However, due to Envprobe being a straightforward tool, other distributions are expected to work fine.
Operating system |
Required dependencies |
Shells supported |
Ubuntu 18.04 LTS (Bionic Beaver) |
Python ≥ 3.6 |
Bash (≥ 4.4), Zsh (≥ 5.4) |
Ubuntu 20.04 LTS (Focal Fossa) |
Python ≥ 3.8 |
Bash (≥ 5.0), Zsh (≥ 5.8) |