A utility for validating paths in environment variables and modifying them safely
Project description
Path-diag
A utility for validating paths in environment variables and modifying them safely.
Prerequisites
- Python 3
Installation
You can install path-diag
via pip
:
pip3 install path-diag
Usage
Diagnose environment variable problems
Check if $PATH
contains any invalid paths:
$ pathdiag
$PATH
is the default variable to check.
You can specify another variable. For example:
$ pathdiag --var PYTHONPATH
You can also specify an increased verbosity which will also print the paths that are successfully checked:
$ pathdiag -v
✓ /usr/local/bin
✓ /usr/bin
✓ /bin
✓ /usr/sbin
✓ /sbin
Safely append/prepend paths to environment variables
You can use the bash functions in order to take advantage of this features by adding the following line on top of your .bashrc
/.zshrc
file:
source /usr/local/bin/path-diag-functions.sh
Then you can use the safe_append
/safe_prepend
functions. For example:
safe_append "/usr/local/Cellar/node/7.4.0/bin"
safe_prepend "/usr/local/opt/python/libexec/bin"
This will add /usr/local/Cellar/node/7.4.0/bin
at the end of $PATH
if this path passes the validation checks, and will also add /usr/local/opt/python/libexec/bin
at the beginning of $PATH
, again if no errors are identified.
Contributing
All contributions are welcomed. Make sure your code passes flake8
checks and that is auto-formatted using black
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for path_diag-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c249b0a9cf919b6b6723417866a08fe45775459b384a04ad158d2f83902ef9f9 |
|
MD5 | 23a47c43e440e8ef530387277a6d01c1 |
|
BLAKE2b-256 | 132a5cb9749884d7c63dcc1e24ecb1c1ecde2dd5ed127bb0d6011663f92c7947 |