path-helper

module
v0.0.0-...-6446b4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2024 License: Apache-2.0

README

path-helper

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`

Install

The most convenient way would be:

curl -sL https://raw.githubusercontent.com/otaviof/path-helper/main/hack/install-lastest-release.sh | sh

This process is automated by this script, you should consider running on your repository clone, i.e.:

hack/install-lastest-release.sh

To 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-helper

Usage Examples

Please consider --help to see all possible options:

path-helper --help

Skipping duplicated entries, if any:

path-helper -s

Skipping non-existing directory:

path-helper -d
Shell Configuration Example

Evaluate 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 ;

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL