Command-line application to generate PATH and MANPATH environment variables based on a configuration directory, the same approach used in MacOS.
By default, PATH is genarated based in /etc/paths.d directory, while MANPATH is based on /etc/manpaths.d, you can configure these locations.
Files created on these directories are listed alphabetically, each line in a file corresponds to a another directory that should become part of PATH and MANPATH.
Configuration files may as well contain environment variables which will be expanded during execution.
Please consider the local example of paths.d.
In short, the usage of path-helper is:
eval `path-helper`The most convenient way would be:
curl -sL https://raw.githubusercontent.com/otaviof/path-helper/main/hack/install-lastest-release.sh | shThis process is automated by this script, you should consider running on your repository clone, i.e.:
hack/install-lastest-release.shTo install path-helper consider the release page and download pre-compiled binaries for your platform. Once the tarball is downloaded, you need to extract and install on the desired location, like the example snippet below
cd /tmp
tar -zxvpf path-helper-ostype-arch.tar.gz path-helper
install -m 0755 path-helper /usr/local/bin/path-helperPlease consider --help to see all possible options:
path-helper --helpSkipping duplicated entries, if any:
path-helper -sSkipping non-existing directory:
path-helper -dEvaluate path-helper output in order to export PATH and MANPATH environment variables. The following example checks if path-helper is present in default location, and later runs eval against:
declare -r PATH_HELPER_BIN="/usr/local/bin/path-helper"
[[ -x "${PATH_HELPER_BIN}" ]] &&
eval "$(${PATH_HELPER_BIN})"Running path-helper without eval, would print out the Shell script snippet it generateds. For instance:
$ path-helper
PATH="..." ; MANPATH="..." ; export PATH MANPATH ;